Package org.apache.poi.xssf.streaming
Class StreamingSheetWriter
- java.lang.Object
-
- org.apache.poi.xssf.streaming.SheetDataWriter
-
- org.apache.poi.xssf.streaming.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 Summary
Constructors Constructor Description StreamingSheetWriter()StreamingSheetWriter(java.io.OutputStream out)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()flush and close the temp data writer.java.io.FilecreateTempFile()Create a temp file to write sheet data.java.io.WritercreateWriter(java.io.File fd)Create a writer for the sheet data.java.io.InputStreamgetWorksheetXMLInputStream()-
Methods inherited from class org.apache.poi.xssf.streaming.SheetDataWriter
getLastFlushedRow, getLowestIndexOfFlushedRows, getNumberOfCellsOfLastFlushedRow, getNumberOfFlushedRows, writeCell, writeRow
-
-
-
-
Method Detail
-
createTempFile
public java.io.File createTempFile() throws java.io.IOExceptionDescription copied from class:SheetDataWriterCreate 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:
createTempFilein classSheetDataWriter- Returns:
- temp file to write sheet data
- Throws:
java.io.IOException
-
createWriter
public java.io.Writer createWriter(java.io.File fd) throws java.io.IOExceptionDescription copied from class:SheetDataWriterCreate a writer for the sheet data.- Overrides:
createWriterin classSheetDataWriter- Parameters:
fd- the file to write to- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionDescription copied from class:SheetDataWriterflush and close the temp data writer. This method must be invoked before callingSheetDataWriter.getWorksheetXMLInputStream()- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classSheetDataWriter- Throws:
java.io.IOException
-
getWorksheetXMLInputStream
public java.io.InputStream getWorksheetXMLInputStream() throws java.io.IOException- Overrides:
getWorksheetXMLInputStreamin classSheetDataWriter- Returns:
- a stream to read temp file with the sheet data
- Throws:
java.io.IOException
-
-