Class StreamingSheetWriter

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    @Beta
    public class StreamingSheetWriter
    extends SheetDataWriter
    Unlike SheetDataWriter, this writer does not create a temporary file, it writes data directly to the provided OutputStream.
    Since:
    5.0.0
    • Constructor Detail

      • StreamingSheetWriter

        public StreamingSheetWriter()
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • StreamingSheetWriter

        public StreamingSheetWriter​(java.io.OutputStream out)
                             throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • createTempFile

        public java.io.File createTempFile()
                                    throws java.io.IOException
        Description copied from class: SheetDataWriter
        Create a temp file to write sheet data. By default, temp files are created in the default temporary-file directory with a prefix "poi-sxssf-sheet" and suffix ".xml". Subclasses can override it and specify a different temp directory or filename or suffix, e.g. .gz
        Overrides:
        createTempFile in class SheetDataWriter
        Returns:
        temp file to write sheet data
        Throws:
        java.io.IOException
      • createWriter

        public java.io.Writer createWriter​(java.io.File fd)
                                    throws java.io.IOException
        Description copied from class: SheetDataWriter
        Create a writer for the sheet data.
        Overrides:
        createWriter in class SheetDataWriter
        Parameters:
        fd - the file to write to
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Description copied from class: SheetDataWriter
        flush and close the temp data writer. This method must be invoked before calling SheetDataWriter.getWorksheetXMLInputStream()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class SheetDataWriter
        Throws:
        java.io.IOException
      • getWorksheetXMLInputStream

        public java.io.InputStream getWorksheetXMLInputStream()
                                                       throws java.io.IOException
        Overrides:
        getWorksheetXMLInputStream in class SheetDataWriter
        Returns:
        a stream to read temp file with the sheet data
        Throws:
        java.io.IOException