Package cdc.impex.exports
Interface StreamExporter
-
- All Superinterfaces:
AutoCloseable,Closeable,Flushable
public interface StreamExporter extends Flushable, Closeable
Interface implemented by classes that can be used to export data.This is a low level API that should be used like this:
beginExport(file/stream); foreach (sheet): beginSheet(sheet.template); foreach (row): beginRow(); foreach(column): setData(column, data); endRow(); endSheet(); endExport();- Author:
- Damien Carbonne
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddReadme(List<SheetTemplate> templates)voidaddRow(ExportRow row)voidbeginExport(File file)Must be invoked at beginning of export to aFile.voidbeginExport(OutputStream out, ImpExFormat format)Must be invoked at beginning of export to anOutputStream.voidbeginSheet(SheetTemplate template, String sheetName, long numberOfRows)Must be invoked at the beginning of a sheet export.voidendExport()Must be invoked at end of export.voidendSheet()Must be invoked at the end of writing a sheet.
-
-
-
Method Detail
-
beginExport
void beginExport(File file) throws IOException
Must be invoked at beginning of export to aFile.The used
Charsetis the one defined inWorkbookWriterFeaturesassociated to theImpExFactoryFeatures.- Parameters:
file- The target file.- Throws:
IOException- When a IO error occurs.IllegalArgumentException- Whenfileisnull.
-
beginExport
void beginExport(OutputStream out, ImpExFormat format) throws IOException
Must be invoked at beginning of export to anOutputStream.The used
Charsetis the one defined inWorkbookWriterFeaturesassociated to theImpExFactoryFeatures.- Parameters:
out- The output stream.format- The format.- Throws:
IOException- When a IO error occurs.IllegalArgumentException- Whenoutorformatisnull, or whenformatis not supported.
-
addReadme
void addReadme(List<SheetTemplate> templates) throws IOException
- Throws:
IOException
-
beginSheet
void beginSheet(SheetTemplate template, String sheetName, long numberOfRows) throws IOException
Must be invoked at the beginning of a sheet export.Using several times the same template in a workbook must be supported.
- Parameters:
template- The template used for that sheet.sheetName- The sheet name.numberOfRows- The number of rows to export in this sheet, or -1L if unknown.- Throws:
IOException- When a IO error occurs.
-
addRow
void addRow(ExportRow row) throws IOException
- Throws:
IOException
-
endSheet
void endSheet() throws IOExceptionMust be invoked at the end of writing a sheet.- Throws:
IOException- When a IO error occurs.
-
endExport
void endExport() throws IOExceptionMust be invoked at end of export.WARNING This will not close this export driver.
- Throws:
IOException- When a IO error occurs.
-
-