Class Packer


  • public class Packer
    extends java.lang.Object
    Class representing packer to compile XLSX files
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Packer.Relationship
      Nested class representing a relationship (MSXML)
    • Constructor Summary

      Constructors 
      Constructor Description
      Packer​(LowLevel reference)
      Default constructor with parameter
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addPart​(java.lang.String name, java.lang.String contentType, org.w3c.dom.Document document)
      Adds a Part to the file
      void addPart​(java.lang.String name, java.lang.String contentType, org.w3c.dom.Document document, boolean includeInContentType)
      Adds a Part to the file
      Packer.Relationship createRelationship​(java.lang.String path)
      Creates a relationship.
      void pack​(java.io.OutputStream stream)
      Method to pack the data into a XLSX file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Packer

        public Packer​(LowLevel reference)
        Default constructor with parameter
        Parameters:
        reference - Reference to the low level instance
    • Method Detail

      • addPart

        public void addPart​(java.lang.String name,
                            java.lang.String contentType,
                            org.w3c.dom.Document document)
                     throws IOException
        Adds a Part to the file
        Parameters:
        name - Filename with relative path
        contentType - URL with information about the content type (MSXML).
        This information is used in the main content type file
        document - XML document to add
        Throws:
        IOException - Thrown if the document could not be converted to a byte array
      • addPart

        public void addPart​(java.lang.String name,
                            java.lang.String contentType,
                            org.w3c.dom.Document document,
                            boolean includeInContentType)
                     throws IOException
        Adds a Part to the file
        Parameters:
        name - Filename with relative path
        contentType - URL with information about the content type (MSXML).
        This information is used in the main content type file
        document - XML document to add
        includeInContentType - If true, the content type will be added in the main content type file, otherwise not
        Throws:
        IOException - Thrown if the document could not be converted to a byte array
      • createRelationship

        public Packer.Relationship createRelationship​(java.lang.String path)
        Creates a relationship. This will be used to generate a .rels file in the compilation (MSXML)
        Parameters:
        path - relative path and filename to rels file (e.g. _rels/.rels)
        Returns:
        Returns the object reference to add relationship entries
      • pack

        public void pack​(java.io.OutputStream stream)
                  throws IOException
        Method to pack the data into a XLSX file. This is the actual compiling and writing method (to a OutputStream)
        Parameters:
        stream - OutputStream to save the data into
        Throws:
        IOException - Thrown in case of a error while packing or writing