Class CSVGenericFormatter

  • All Implemented Interfaces:

    public class CSVGenericFormatter
    extends AbstractGenericFormatter
    Alternative to CSVFormatter which is schema-specific and a bit rigid. ResultsFormatter interface assumes an "extraction result"
    • Constructor Detail

      • CSVGenericFormatter

        public CSVGenericFormatter​(Parameters p)
    • Method Detail

      • setDelimiter

        public void setDelimiter​(java.lang.String ch)
      • createOutputStreams

        protected void createOutputStreams()
                                    throws java.lang.Exception
        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 class AbstractGenericFormatter
        java.lang.Exception - when unable to create output stream
      • writeRow

        public void writeRow​(java.util.Map<java.lang.String,​java.lang.Object> values)
        Write the data to the output stream.
        Specified by:
        writeRow in class AbstractGenericFormatter
        values - Map of data
      • buildSchema

        protected void buildSchema()
                            throws ConfigException
        Create a schema instance with the fields properly typed and ordered
        ConfigException - schema configuration error
      • canAdd

        protected boolean canAdd​(java.lang.String f)
      • addColumn

        protected void addColumn​(java.util.Map<java.lang.String,​java.lang.String> row,
                                 java.lang.String f,
                                 java.lang.String d)
        Add a column of data to output; Field is validated ; value is not added if null
      • addColumn

        protected void addColumn​(java.util.Map<java.lang.String,​java.lang.String> row,
                                 java.lang.String f,
                                 int d)
      • formatResults

        public java.lang.String formatResults​(ExtractionResult result)
                                       throws ProcessingException
        Not implemented: this formatter is more flexible than requiring you to use it for Extraction output
        A message for the user
        ProcessingException - formatting error