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
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
Add a column of data to output; Field is validated ; value is not added if nullprotected void
Create a schema instance with the fields properly typed and orderedprotected boolean
protected void
Close output streams.protected void
Create the output stream appropriate for the output type.void
finish()
Finish.formatResults
(ExtractionResult result) Not implemented: this formatter is more flexible than requiring you to use it for Extraction outputvoid
setDelimiter
(String ch) void
Start.void
Write 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:AbstractGenericFormatter
Start.- Specified by:
start
in interfaceResultsFormatter
- Specified by:
start
in classAbstractGenericFormatter
- Parameters:
nm
- output file name/worksheet name- Throws:
ProcessingException
-
finish
public void finish()Description copied from class:AbstractGenericFormatter
Finish.- Specified by:
finish
in interfaceResultsFormatter
- Specified by:
finish
in classAbstractGenericFormatter
-
createOutputStreams
Description copied from class:AbstractGenericFormatter
Create the output stream appropriate for the output type. IO is created using the filename represented by getOutputFilepath()- Specified by:
createOutputStreams
in classAbstractGenericFormatter
- Throws:
Exception
- when unable to create output stream
-
closeOutputStreams
Description copied from class:AbstractGenericFormatter
Close output streams.- Specified by:
closeOutputStreams
in classAbstractGenericFormatter
- Throws:
Exception
-
writeRow
Write the data to the output stream.- Specified by:
writeRow
in 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
-