Package cdc.impex.exports
Interface StreamExporter
- All Superinterfaces:
AutoCloseable,Closeable,Flushable
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
Modifier and TypeMethodDescriptionvoidaddReadme(List<SheetTemplateInstance> templateInstances) voidvoidbeginExport(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(SheetTemplateInstance templateInstance, String sheetName, long numberOfRows) Must be invoked at the beginning of a sheet export.voidMust be invoked at end of export.voidendSheet()Must be invoked at the end of writing a sheet.
-
Method Details
-
beginExport
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
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
- Throws:
IOException
-
beginSheet
void beginSheet(SheetTemplateInstance templateInstance, 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:
templateInstance- The sheet template instance 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
- Throws:
IOException
-
endSheet
Must be invoked at the end of writing a sheet.- Throws:
IOException- When a IO error occurs.
-
endExport
Must be invoked at end of export.WARNING This will not close this export driver.
- Throws:
IOException- When a IO error occurs.
-