Package org.opensextant.output
Class CSVGenericFormatter
java.lang.Object
org.opensextant.output.AbstractGenericFormatter
org.opensextant.output.CSVGenericFormatter
- All Implemented Interfaces:
ResultsFormatter
Alternative to CSVFormatter which is schema-specific and a bit
rigid. ResultsFormatter interface assumes an "extraction result"
- Author:
- ubaldino
-
Field Summary
Fields inherited from class org.opensextant.output.AbstractGenericFormatter
debug, fieldOrder, fieldSet, log, outputExtension, outputParams, outputType, overwrite, TEXT_WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidAdd a column of data to output; Field is validated ; value is not added if nullprotected voidCreate a schema instance with the fields properly typed and orderedprotected booleanprotected voidClose output streams.protected voidCreate the output stream appropriate for the output type.voidfinish()Finish.formatResults(ExtractionResult result) Not implemented: this formatter is more flexible than requiring you to use it for Extraction outputvoidsetDelimiter(String ch) voidStart.voidWrite the data to the output stream.Methods inherited from class org.opensextant.output.AbstractGenericFormatter
addField, checkOverwrite, createOutputFileName, defaultFields, deleteOutput, getJobName, getOutputFilepath, getOutputType, removeField, setOutputDir, setOutputFilename, setParameters
-
Constructor Details
-
CSVGenericFormatter
-
-
Method Details
-
setDelimiter
-
start
Description copied from class:AbstractGenericFormatterStart.- Specified by:
startin interfaceResultsFormatter- Specified by:
startin classAbstractGenericFormatter- Parameters:
nm- output file name/worksheet name- Throws:
ProcessingException
-
finish
public void finish()Description copied from class:AbstractGenericFormatterFinish.- Specified by:
finishin interfaceResultsFormatter- Specified by:
finishin classAbstractGenericFormatter
-
createOutputStreams
Description copied from class:AbstractGenericFormatterCreate the output stream appropriate for the output type. IO is created using the filename represented by getOutputFilepath()- Specified by:
createOutputStreamsin classAbstractGenericFormatter- Throws:
Exception- when unable to create output stream
-
closeOutputStreams
Description copied from class:AbstractGenericFormatterClose output streams.- Specified by:
closeOutputStreamsin classAbstractGenericFormatter- Throws:
Exception
-
writeRow
Write the data to the output stream.- Specified by:
writeRowin classAbstractGenericFormatter- Parameters:
values- Map of data
-
buildSchema
Create a schema instance with the fields properly typed and ordered- Throws:
ConfigException- schema configuration error
-
canAdd
-
addColumn
Add a column of data to output; Field is validated ; value is not added if null -
addColumn
-
formatResults
Not implemented: this formatter is more flexible than requiring you to use it for Extraction output- Returns:
- A message for the user
- Throws:
ProcessingException- formatting error
-