Class LowLevel


  • public class LowLevel
    extends Object
    Class for low level handling (XML, formatting, preparing of packing)
    This class is only for internal use. Use the high level API (e.g. class Workbook) to manipulate data and create Excel files.
    Author:
    Raphael Stoeckli
    • Constructor Detail

      • LowLevel

        public LowLevel​(Workbook workbook)
        Constructor with defined workbook object
        Parameters:
        workbook - Workbook to process
    • Method Detail

      • getDocumentInterception

        public boolean getDocumentInterception()
        Gets whether XML documents are intercepted during creation
        Returns:
        If true, documents will be intercepted and stored into interceptedDocuments
      • setDocumentInterception

        public void setDocumentInterception​(boolean interceptDocuments)
        Set whether XML documents are intercepted during creation
        Parameters:
        interceptDocuments - If true, documents will be intercepted and stored into interceptedDocuments
      • getInterceptedDocuments

        public HashMap<String,​Document> getInterceptedDocuments()
        Gets the intercepted documents if interceptDocuments is set to true
        Returns:
        HashMap with a String as key and a XML document as value
      • createXMLDocument

        public Document createXMLDocument​(String rawInput,
                                          String title)
                                   throws IOException
        Creates a XML document from a string
        Parameters:
        rawInput - String to process
        title - Title for interception / debugging purpose
        Returns:
        Formatted XML document
        Throws:
        IOException - Thrown in case of an error while creating the XML document
      • save

        public void save()
                  throws IOException
        Method to save the workbook
        Throws:
        IOException - Thrown in case of an error
      • createBytesFromDocument

        public static byte[] createBytesFromDocument​(Document document)
                                              throws IOException
        Method to convert an XML document to a byte array
        Parameters:
        document - Document to process
        Returns:
        array of bytes (UTF-8)
        Throws:
        IOException - Thrown if the document could not be converted to a byte array