Class AbstractRoutines<P extends CommonParserSettings<?>,​W extends CommonWriterSettings<?>>

  • Type Parameters:
    P - parser configuration class
    W - writer configuration class
    Direct Known Subclasses:
    CsvRoutines, FixedWidthRoutines, TsvRoutines

    public abstract class AbstractRoutines<P extends CommonParserSettings<?>,​W extends CommonWriterSettings<?>>
    extends java.lang.Object
    Basic implementation of commonly used routines around parsing/writing of data that can be reused and extended by parsers/writers of any supported format.
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractRoutines​(java.lang.String routineDescription)
      Creates a new instance of this routine class.
      AbstractRoutines​(java.lang.String routineDescription, P parserSettings)
      Creates a new instance of this routine class.
      AbstractRoutines​(java.lang.String routineDescription, P parserSettings, W writerSettings)
      Creates a new instance of this routine class.
      AbstractRoutines​(java.lang.String routineDescription, W writerSettings)
      Creates a new instance of this routine class.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void adjustColumnLengths​(java.lang.String[] headers, int[] lengths)
      Allows writers of any given format to adjust its settings to take into account column headers and lengths prior to writing data in any routine.
      private void close​(AbstractWriter writer)  
      protected abstract P createDefaultParserSettings()
      Creates a default parser settings configuration
      protected abstract W createDefaultWriterSettings()
      Creates a default writer settings configuration
      protected abstract AbstractParser<P> createParser​(P parserSettings)
      Creates a new parser implementation using the given parser configuration
      protected abstract AbstractWriter<W> createWriter​(java.io.Writer output, W writerSettings)
      Creates a new writer implementation using the given writer configuration
      private RowProcessor createWritingRowProcessor​(java.io.Writer output)  
      ColumnMapper getColumnMapper()
      Returns a mapper that allows users to manually define mappings from attributes/methods of a given class to columns to be parsed or written in routines that manipulate java beans.
      InputDimension getInputDimension​(java.io.File input)
      Calculates the dimensions of a file (row and column count).
      InputDimension getInputDimension​(java.io.File input, java.lang.String encoding)
      Calculates the dimensions of a file (row and column count).
      InputDimension getInputDimension​(java.io.InputStream input)
      Calculates the dimensions of a given input (row and column count).
      InputDimension getInputDimension​(java.io.InputStream input, java.lang.String encoding)
      Calculates the dimensions of a given input (row and column count).
      InputDimension getInputDimension​(java.io.Reader input)
      Calculates the dimensions of a given input (row and column count).
      boolean getKeepResourcesOpen()
      Returns a flag indicating whether resources used for writing should be kept open after being used by the routines available from this object, when applicable.
      P getParserSettings()
      Returns the parser configuration (if any) used by the routines of this utility class.
      W getWriterSettings()
      Returns the writer configuration (if any) used by the routines of this utility class.
      <T> IterableResult<T,​ParsingContext> iterate​(java.lang.Class<T> beanType, java.io.File input)
      Iterates over a file to produce instances of annotated java beans on demand.
      <T> IterableResult<T,​ParsingContext> iterate​(java.lang.Class<T> beanType, java.io.File input, java.lang.String encoding)
      Iterates over a file to produce instances of annotated java beans on demand.
      <T> IterableResult<T,​ParsingContext> iterate​(java.lang.Class<T> beanType, java.io.File input, java.nio.charset.Charset encoding)
      Iterates over a file to produce instances of annotated java beans on demand.
      <T> IterableResult<T,​ParsingContext> iterate​(java.lang.Class<T> beanType, java.io.InputStream input)
      Iterates over an input stream to produce instances of annotated java beans on demand.
      <T> IterableResult<T,​ParsingContext> iterate​(java.lang.Class<T> beanType, java.io.InputStream input, java.lang.String encoding)
      Iterates over an input stream to produce instances of annotated java beans on demand.
      <T> IterableResult<T,​ParsingContext> iterate​(java.lang.Class<T> beanType, java.io.InputStream input, java.nio.charset.Charset encoding)
      Iterates over an input stream to produce instances of annotated java beans on demand.
      <T> IterableResult<T,​ParsingContext> iterate​(java.lang.Class<T> beanType, java.io.Reader input)
      Iterates over an input to produce instances of annotated java beans on demand.
      <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType, java.io.File input)
      Parses a file into a list of annotated java beans
      <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType, java.io.File input, int expectedBeanCount)
      Parses a file into a list of annotated java beans
      <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType, java.io.File input, java.lang.String encoding)
      Parses a file into a list of annotated java beans
      <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType, java.io.File input, java.lang.String encoding, int expectedBeanCount)
      Parses a file into a list of annotated java beans
      <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType, java.io.File input, java.nio.charset.Charset encoding)
      Parses a file into a list of annotated java beans
      <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType, java.io.File input, java.nio.charset.Charset encoding, int expectedBeanCount)
      Parses a file into a list of annotated java beans
      <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType, java.io.InputStream input)
      Parses an input stream into a list of annotated java beans
      <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType, java.io.InputStream input, int expectedBeanCount)
      Parses an input stream into a list of annotated java beans
      <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType, java.io.InputStream input, java.lang.String encoding)
      Parses an input stream into a list of annotated java beans
      <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType, java.io.InputStream input, java.lang.String encoding, int expectedBeanCount)
      Parses an input stream into a list of annotated java beans
      <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType, java.io.InputStream input, java.nio.charset.Charset encoding)
      Parses an input stream into a list of annotated java beans
      <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType, java.io.InputStream input, java.nio.charset.Charset encoding, int expectedBeanCount)
      Parses an input stream into a list of annotated java beans
      <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType, java.io.Reader input)
      Parses the input into a list of annotated java beans
      <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType, java.io.Reader input, int expectedBeanCount)
      Parses the input into a list of annotated java beans
      void parseAndWrite​(java.io.Reader input, java.io.Writer output)
      Reads all data from a given input and writes it to an output.
      void setColumnMapper​(ColumnMapper columnMapper)
      Copies the given column mappings over to this processor.
      void setKeepResourcesOpen​(boolean keepResourcesOpen)
      Allows preventing resources used for writing from being closed after being used by the routines available from this object, when applicable.
      void setParserSettings​(P parserSettings)
      Defines the parser configuration to be used by the routines of this utility class.
      private void setRowProcessor​(RowProcessor rowProcessor)  
      private void setRowWriterProcessor​(RowWriterProcessor rowWriterProcessor)  
      void setWriterSettings​(W writerSettings)
      Defines the writer configuration to be used by the routines of this utility class.
      java.lang.String toString()  
      private void validateParserSettings()  
      private void validateWriterSettings()  
      void write​(java.sql.ResultSet rs, java.io.File output)
      Dumps the content of a ResultSet into a file.
      void write​(java.sql.ResultSet rs, java.io.File output, java.lang.String encoding)
      Dumps the content of a ResultSet into a file.
      void write​(java.sql.ResultSet rs, java.io.File output, java.nio.charset.Charset encoding)
      Dumps the content of a ResultSet into a file.
      void write​(java.sql.ResultSet rs, java.io.OutputStream output)
      Dumps the content of a ResultSet into an output stream.
      void write​(java.sql.ResultSet rs, java.io.OutputStream output, java.lang.String encoding)
      Dumps the content of a ResultSet into an output stream.
      void write​(java.sql.ResultSet rs, java.io.OutputStream output, java.nio.charset.Charset encoding)
      Dumps the content of a ResultSet into an output stream.
      void write​(java.sql.ResultSet rs, java.io.Writer output)
      Dumps the content of a ResultSet.
      <T> void writeAll​(java.lang.Iterable<T> elements, java.lang.Class<T> beanType, java.io.File output, java.lang.String... headers)
      Writes a collection of annotated java beans to a given output.
      <T> void writeAll​(java.lang.Iterable<T> elements, java.lang.Class<T> beanType, java.io.File output, java.lang.String encoding, java.lang.String[] headers)
      Writes a collection of annotated java beans to a given output.
      <T> void writeAll​(java.lang.Iterable<T> elements, java.lang.Class<T> beanType, java.io.File output, java.nio.charset.Charset encoding, java.lang.String... headers)
      Writes a collection of annotated java beans to a given output.
      <T> void writeAll​(java.lang.Iterable<T> elements, java.lang.Class<T> beanType, java.io.OutputStream output, java.lang.String... headers)
      Writes a collection of annotated java beans to a given output.
      <T> void writeAll​(java.lang.Iterable<T> elements, java.lang.Class<T> beanType, java.io.OutputStream output, java.lang.String encoding, java.lang.String[] headers)
      Writes a collection of annotated java beans to a given output.
      <T> void writeAll​(java.lang.Iterable<T> elements, java.lang.Class<T> beanType, java.io.OutputStream output, java.nio.charset.Charset encoding, java.lang.String... headers)
      Writes a collection of annotated java beans to a given output.
      <T> void writeAll​(java.lang.Iterable<T> elements, java.lang.Class<T> beanType, java.io.Writer output, java.lang.String... headers)
      Writes a collection of annotated java beans to a given output.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • keepResourcesOpen

        private boolean keepResourcesOpen
      • previousOutput

        private java.io.Writer previousOutput
      • routineDescription

        private final java.lang.String routineDescription
    • Constructor Detail

      • AbstractRoutines

        public AbstractRoutines​(java.lang.String routineDescription)
        Creates a new instance of this routine class.
        Parameters:
        routineDescription - description of the routines for a given format
      • AbstractRoutines

        public AbstractRoutines​(java.lang.String routineDescription,
                                P parserSettings)
        Creates a new instance of this routine class.
        Parameters:
        routineDescription - description of the routines for a given format
        parserSettings - configuration to use for parsing
      • AbstractRoutines

        public AbstractRoutines​(java.lang.String routineDescription,
                                W writerSettings)
        Creates a new instance of this routine class.
        Parameters:
        routineDescription - description of the routines for a given format
        writerSettings - configuration to use for writing
      • AbstractRoutines

        public AbstractRoutines​(java.lang.String routineDescription,
                                P parserSettings,
                                W writerSettings)
        Creates a new instance of this routine class.
        Parameters:
        routineDescription - description of the routines for a given format
        parserSettings - configuration to use for parsing
        writerSettings - configuration to use for writing
    • Method Detail

      • createParser

        protected abstract AbstractParser<P> createParser​(P parserSettings)
        Creates a new parser implementation using the given parser configuration
        Parameters:
        parserSettings - the configuration for new parser
        Returns:
        a parser implementation configured according to the given settings object.
      • createWriter

        protected abstract AbstractWriter<W> createWriter​(java.io.Writer output,
                                                          W writerSettings)
        Creates a new writer implementation using the given writer configuration
        Parameters:
        output - target output of the routine.
        writerSettings - the configuration for new writer
        Returns:
        a writer implementation configured according to the given settings object.
      • createDefaultParserSettings

        protected abstract P createDefaultParserSettings()
        Creates a default parser settings configuration
        Returns:
        a new instance of a usable parser configuration.
      • createDefaultWriterSettings

        protected abstract W createDefaultWriterSettings()
        Creates a default writer settings configuration
        Returns:
        a new instance of a usable writer configuration.
      • validateWriterSettings

        private void validateWriterSettings()
      • validateParserSettings

        private void validateParserSettings()
      • getParserSettings

        public final P getParserSettings()
        Returns the parser configuration (if any) used by the routines of this utility class.
        Returns:
        the parser configuration.
      • setParserSettings

        public final void setParserSettings​(P parserSettings)
        Defines the parser configuration to be used by the routines of this utility class.
        Parameters:
        parserSettings - the parser configuration.
      • getWriterSettings

        public final W getWriterSettings()
        Returns the writer configuration (if any) used by the routines of this utility class.
        Returns:
        the writer configuration.
      • setWriterSettings

        public final void setWriterSettings​(W writerSettings)
        Defines the writer configuration to be used by the routines of this utility class.
        Parameters:
        writerSettings - the parser configuration.
      • adjustColumnLengths

        protected void adjustColumnLengths​(java.lang.String[] headers,
                                           int[] lengths)
        Allows writers of any given format to adjust its settings to take into account column headers and lengths prior to writing data in any routine.
        Parameters:
        headers - headers to be written
        lengths - the corresponding lengths of each header
      • write

        public final void write​(java.sql.ResultSet rs,
                                java.io.File output)
        Dumps the content of a ResultSet into a file.
        Parameters:
        rs - the ResultSet whose contents should be read and written to a given output
        output - the output file that will store the data in the given ResultSet in the format specified by concrete implementations of this class.
      • write

        public final void write​(java.sql.ResultSet rs,
                                java.io.File output,
                                java.lang.String encoding)
        Dumps the content of a ResultSet into a file.
        Parameters:
        rs - the ResultSet whose contents should be read and written to a given output
        output - the output file that will store the data in the given ResultSet in the format specified by concrete implementations of this class.
        encoding - the output encoding of the file
      • write

        public final void write​(java.sql.ResultSet rs,
                                java.io.File output,
                                java.nio.charset.Charset encoding)
        Dumps the content of a ResultSet into a file.
        Parameters:
        rs - the ResultSet whose contents should be read and written to a given output
        output - the output file that will store the data in the given ResultSet in the format specified by concrete implementations of this class.
        encoding - the output encoding of the file
      • write

        public final void write​(java.sql.ResultSet rs,
                                java.io.OutputStream output)
        Dumps the content of a ResultSet into an output stream.
        Parameters:
        rs - the ResultSet whose contents should be read and written to a given output
        output - the output stream that will store the data in the given ResultSet in the format specified by concrete implementations of this class.
      • write

        public final void write​(java.sql.ResultSet rs,
                                java.io.OutputStream output,
                                java.lang.String encoding)
        Dumps the content of a ResultSet into an output stream.
        Parameters:
        rs - the ResultSet whose contents should be read and written to a given output
        output - the output file that will store the data in the given ResultSet in the format specified by concrete implementations of this class.
        encoding - the output encoding of the output stream
      • write

        public final void write​(java.sql.ResultSet rs,
                                java.io.OutputStream output,
                                java.nio.charset.Charset encoding)
        Dumps the content of a ResultSet into an output stream.
        Parameters:
        rs - the ResultSet whose contents should be read and written to a given output
        output - the output file that will store the data in the given ResultSet in the format specified by concrete implementations of this class.
        encoding - the output encoding of the output stream
      • write

        public final void write​(java.sql.ResultSet rs,
                                java.io.Writer output)
        Dumps the content of a ResultSet.
        Parameters:
        rs - the ResultSet whose contents should be read and written to a given output
        output - the output that will store the data in the given ResultSet in the format specified by concrete implementations of this class.
      • parseAndWrite

        public final void parseAndWrite​(java.io.Reader input,
                                        java.io.Writer output)
        Reads all data from a given input and writes it to an output.
        Parameters:
        input - the input data to be parsed using the settings provided in getParserSettings()
        output - the output into where the input data should be written, using the format provided in getWriterSettings()
      • setRowWriterProcessor

        private void setRowWriterProcessor​(RowWriterProcessor rowWriterProcessor)
      • setRowProcessor

        private void setRowProcessor​(RowProcessor rowProcessor)
      • createWritingRowProcessor

        private RowProcessor createWritingRowProcessor​(java.io.Writer output)
      • writeAll

        public <T> void writeAll​(java.lang.Iterable<T> elements,
                                 java.lang.Class<T> beanType,
                                 java.io.File output,
                                 java.lang.String... headers)
        Writes a collection of annotated java beans to a given output.
        Type Parameters:
        T - the type of element in the given collection
        Parameters:
        elements - the elements to write to the output
        beanType - the type of element in the given collection
        output - the output into which the given elements will be written
        headers - headers to use in the first row of the written result.
      • writeAll

        public <T> void writeAll​(java.lang.Iterable<T> elements,
                                 java.lang.Class<T> beanType,
                                 java.io.File output,
                                 java.lang.String encoding,
                                 java.lang.String[] headers)
        Writes a collection of annotated java beans to a given output.
        Type Parameters:
        T - the type of element in the given collection
        Parameters:
        elements - the elements to write to the output
        beanType - the type of element in the given collection
        output - the output into which the given elements will be written
        encoding - the output encoding to use for writing
        headers - headers to use in the first row of the written result.
      • writeAll

        public <T> void writeAll​(java.lang.Iterable<T> elements,
                                 java.lang.Class<T> beanType,
                                 java.io.File output,
                                 java.nio.charset.Charset encoding,
                                 java.lang.String... headers)
        Writes a collection of annotated java beans to a given output.
        Type Parameters:
        T - the type of element in the given collection
        Parameters:
        elements - the elements to write to the output
        beanType - the type of element in the given collection
        output - the output into which the given elements will be written
        encoding - the output encoding to use for writing
        headers - headers to use in the first row of the written result.
      • writeAll

        public <T> void writeAll​(java.lang.Iterable<T> elements,
                                 java.lang.Class<T> beanType,
                                 java.io.OutputStream output,
                                 java.lang.String... headers)
        Writes a collection of annotated java beans to a given output.
        Type Parameters:
        T - the type of element in the given collection
        Parameters:
        elements - the elements to write to the output
        beanType - the type of element in the given collection
        output - the output into which the given elements will be written
        headers - headers to use in the first row of the written result.
      • writeAll

        public <T> void writeAll​(java.lang.Iterable<T> elements,
                                 java.lang.Class<T> beanType,
                                 java.io.OutputStream output,
                                 java.lang.String encoding,
                                 java.lang.String[] headers)
        Writes a collection of annotated java beans to a given output.
        Type Parameters:
        T - the type of element in the given collection
        Parameters:
        elements - the elements to write to the output
        beanType - the type of element in the given collection
        output - the output into which the given elements will be written
        encoding - the output encoding to use for writing
        headers - headers to use in the first row of the written result.
      • writeAll

        public <T> void writeAll​(java.lang.Iterable<T> elements,
                                 java.lang.Class<T> beanType,
                                 java.io.OutputStream output,
                                 java.nio.charset.Charset encoding,
                                 java.lang.String... headers)
        Writes a collection of annotated java beans to a given output.
        Type Parameters:
        T - the type of element in the given collection
        Parameters:
        elements - the elements to write to the output
        beanType - the type of element in the given collection
        output - the output into which the given elements will be written
        encoding - the output encoding to use for writing
        headers - headers to use in the first row of the written result.
      • writeAll

        public <T> void writeAll​(java.lang.Iterable<T> elements,
                                 java.lang.Class<T> beanType,
                                 java.io.Writer output,
                                 java.lang.String... headers)
        Writes a collection of annotated java beans to a given output.
        Type Parameters:
        T - the type of element in the given collection
        Parameters:
        elements - the elements to write to the output
        beanType - the type of element in the given collection
        output - the output into which the given elements will be written
        headers - headers to use in the first row of the written result.
      • parseAll

        public <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType,
                                              java.io.File input,
                                              int expectedBeanCount)
        Parses a file into a list of annotated java beans
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the file to be parsed
        expectedBeanCount - expected number of rows to be parsed from the input which will be converted into java beans. Used to pre-allocate the size of the output List
        Returns:
        an Iterable that allows iterating over the input and producing instances of java beans on demand.
      • parseAll

        public <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType,
                                              java.io.File input,
                                              java.lang.String encoding,
                                              int expectedBeanCount)
        Parses a file into a list of annotated java beans
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the file to be parsed
        encoding - encoding of the given file
        expectedBeanCount - expected number of rows to be parsed from the input which will be converted into java beans. Used to pre-allocate the size of the output List
        Returns:
        an Iterable that allows iterating over the input and producing instances of java beans on demand.
      • parseAll

        public <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType,
                                              java.io.File input,
                                              java.nio.charset.Charset encoding,
                                              int expectedBeanCount)
        Parses a file into a list of annotated java beans
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the file to be parsed
        encoding - encoding of the given file
        expectedBeanCount - expected number of rows to be parsed from the input which will be converted into java beans. Used to pre-allocate the size of the output List
        Returns:
        a list containing all java beans read from the input.
      • parseAll

        public <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType,
                                              java.io.InputStream input,
                                              int expectedBeanCount)
        Parses an input stream into a list of annotated java beans
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the input stream to be parsed
        expectedBeanCount - expected number of rows to be parsed from the input which will be converted into java beans. Used to pre-allocate the size of the output List
        Returns:
        a list containing all java beans read from the input.
      • parseAll

        public <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType,
                                              java.io.InputStream input,
                                              java.lang.String encoding,
                                              int expectedBeanCount)
        Parses an input stream into a list of annotated java beans
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the input stream to be parsed
        encoding - encoding of the given input stream
        expectedBeanCount - expected number of rows to be parsed from the input which will be converted into java beans. Used to pre-allocate the size of the output List
        Returns:
        a list containing all java beans read from the input.
      • parseAll

        public <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType,
                                              java.io.InputStream input,
                                              java.nio.charset.Charset encoding,
                                              int expectedBeanCount)
        Parses an input stream into a list of annotated java beans
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the input stream to be parsed
        encoding - encoding of the given input stream
        expectedBeanCount - expected number of rows to be parsed from the input which will be converted into java beans. Used to pre-allocate the size of the output List
        Returns:
        a list containing all java beans read from the input.
      • parseAll

        public <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType,
                                              java.io.Reader input,
                                              int expectedBeanCount)
        Parses the input into a list of annotated java beans
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the input to be parsed
        expectedBeanCount - expected number of rows to be parsed from the input which will be converted into java beans. Used to pre-allocate the size of the output List
        Returns:
        a list containing all java beans read from the input.
      • parseAll

        public <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType,
                                              java.io.File input)
        Parses a file into a list of annotated java beans
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the file to be parsed
        Returns:
        an Iterable that allows iterating over the input and producing instances of java beans on demand.
      • parseAll

        public <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType,
                                              java.io.File input,
                                              java.lang.String encoding)
        Parses a file into a list of annotated java beans
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the file to be parsed
        encoding - encoding of the given file
        Returns:
        an Iterable that allows iterating over the input and producing instances of java beans on demand.
      • parseAll

        public <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType,
                                              java.io.File input,
                                              java.nio.charset.Charset encoding)
        Parses a file into a list of annotated java beans
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the file to be parsed
        encoding - encoding of the given file
        Returns:
        a list containing all java beans read from the input.
      • parseAll

        public <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType,
                                              java.io.InputStream input)
        Parses an input stream into a list of annotated java beans
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the input stream to be parsed
        Returns:
        a list containing all java beans read from the input.
      • parseAll

        public <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType,
                                              java.io.InputStream input,
                                              java.lang.String encoding)
        Parses an input stream into a list of annotated java beans
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the input stream to be parsed
        encoding - encoding of the given input stream
        Returns:
        a list containing all java beans read from the input.
      • parseAll

        public <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType,
                                              java.io.InputStream input,
                                              java.nio.charset.Charset encoding)
        Parses an input stream into a list of annotated java beans
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the input stream to be parsed
        encoding - encoding of the given input stream
        Returns:
        a list containing all java beans read from the input.
      • parseAll

        public <T> java.util.List<T> parseAll​(java.lang.Class<T> beanType,
                                              java.io.Reader input)
        Parses the input into a list of annotated java beans
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the input to be parsed
        Returns:
        a list containing all java beans read from the input.
      • iterate

        public <T> IterableResult<T,​ParsingContext> iterate​(java.lang.Class<T> beanType,
                                                                  java.io.File input)
        Iterates over a file to produce instances of annotated java beans on demand.
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the file to be parsed
        Returns:
        an Iterable that allows iterating over the input and producing instances of java beans on demand.
      • iterate

        public <T> IterableResult<T,​ParsingContext> iterate​(java.lang.Class<T> beanType,
                                                                  java.io.File input,
                                                                  java.lang.String encoding)
        Iterates over a file to produce instances of annotated java beans on demand.
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the file to be parsed
        encoding - encoding of the given file
        Returns:
        an Iterable that allows iterating over the input and producing instances of java beans on demand.
      • iterate

        public <T> IterableResult<T,​ParsingContext> iterate​(java.lang.Class<T> beanType,
                                                                  java.io.File input,
                                                                  java.nio.charset.Charset encoding)
        Iterates over a file to produce instances of annotated java beans on demand.
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the file to be parsed
        encoding - encoding of the given file
        Returns:
        an Iterable that allows iterating over the input and producing instances of java beans on demand.
      • iterate

        public <T> IterableResult<T,​ParsingContext> iterate​(java.lang.Class<T> beanType,
                                                                  java.io.InputStream input)
        Iterates over an input stream to produce instances of annotated java beans on demand.
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the input stream to be parsed
        Returns:
        an Iterable that allows iterating over the input and producing instances of java beans on demand.
      • iterate

        public <T> IterableResult<T,​ParsingContext> iterate​(java.lang.Class<T> beanType,
                                                                  java.io.InputStream input,
                                                                  java.lang.String encoding)
        Iterates over an input stream to produce instances of annotated java beans on demand.
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the input stream to be parsed
        encoding - encoding of the given input stream
        Returns:
        an Iterable that allows iterating over the input and producing instances of java beans on demand.
      • iterate

        public <T> IterableResult<T,​ParsingContext> iterate​(java.lang.Class<T> beanType,
                                                                  java.io.InputStream input,
                                                                  java.nio.charset.Charset encoding)
        Iterates over an input stream to produce instances of annotated java beans on demand.
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the input stream to be parsed
        encoding - encoding of the given input stream
        Returns:
        an Iterable that allows iterating over the input and producing instances of java beans on demand.
      • iterate

        public <T> IterableResult<T,​ParsingContext> iterate​(java.lang.Class<T> beanType,
                                                                  java.io.Reader input)
        Iterates over an input to produce instances of annotated java beans on demand.
        Type Parameters:
        T - the type of java beans to be instantiated.
        Parameters:
        beanType - the type of java beans to be instantiated.
        input - the input to be parsed
        Returns:
        an Iterable that allows iterating over the input and producing instances of java beans on demand.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getInputDimension

        public InputDimension getInputDimension​(java.io.File input)
        Calculates the dimensions of a file (row and column count).
        Parameters:
        input - the file to be parsed
        Returns:
        a InputDimension with information about the dimensions of the given input.
      • getInputDimension

        public InputDimension getInputDimension​(java.io.File input,
                                                java.lang.String encoding)
        Calculates the dimensions of a file (row and column count).
        Parameters:
        input - the file to be parsed
        encoding - encoding of the given file
        Returns:
        a InputDimension with information about the dimensions of the given input.
      • getInputDimension

        public InputDimension getInputDimension​(java.io.InputStream input)
        Calculates the dimensions of a given input (row and column count).
        Parameters:
        input - the input to be parsed
        Returns:
        a InputDimension with information about the dimensions of the given input.
      • getInputDimension

        public InputDimension getInputDimension​(java.io.InputStream input,
                                                java.lang.String encoding)
        Calculates the dimensions of a given input (row and column count).
        Parameters:
        input - the input to be parsed
        encoding - encoding of the given input
        Returns:
        a InputDimension with information about the dimensions of the given input.
      • getInputDimension

        public InputDimension getInputDimension​(java.io.Reader input)
        Calculates the dimensions of a given input (row and column count).
        Parameters:
        input - the input to be parsed
        Returns:
        a InputDimension with information about the dimensions of the given input.
      • getKeepResourcesOpen

        public boolean getKeepResourcesOpen()
        Returns a flag indicating whether resources used for writing should be kept open after being used by the routines available from this object, when applicable.
        Returns:
        flag indicating whether to call the close() (or any other cleanup method) after a routine executes.
      • setKeepResourcesOpen

        public void setKeepResourcesOpen​(boolean keepResourcesOpen)
        Allows preventing resources used for writing from being closed after being used by the routines available from this object, when applicable.
        Parameters:
        keepResourcesOpen - flag indicating whether to call the close() (or any other cleanup method) after a routine executes.
      • getColumnMapper

        public ColumnMapper getColumnMapper()
        Returns a mapper that allows users to manually define mappings from attributes/methods of a given class to columns to be parsed or written in routines that manipulate java beans. This allows users to use instances of classes that are not annotated with Parsed nor Nested. Any mappings defined with the column mapper will take precedence over these annotations.
        Returns:
        the column mapper
      • setColumnMapper

        public void setColumnMapper​(ColumnMapper columnMapper)
        Copies the given column mappings over to this processor. Further changes to the given object won't be reflected on the copy stored internally.
        Parameters:
        columnMapper - the column mappings to use