Interface RecordReader<T>

    • Method Detail

      • getErroneousRecordCount

        long getErroneousRecordCount()
        The number of erroneous records which were not read by the RecordReader.
        Returns:
        the erroneous record count
      • readHeader

        Header<T> readHeader()
                      throws IOException
        Creates a Header from the next line to be read. In case a header has already been provided (in the constructor), then the according header is matched against the next line being read and ordered accordingly, placeholder Column instances are inserted if needed, created by the provided (default) ColumnFactory.
        Returns:
        Returns the Header being read.
        Throws:
        IOException - thrown in case reading from IO failed.
      • readHeader

        Header<T> readHeader​(Column<T>... aColumns)
                      throws IOException
        Creates a Header from the next line to be read. The provided header is matched against the next line being read and ordered accordingly, place holder Column instances are inserted if needed, created by the provided (default) ColumnFactory.
        Parameters:
        aColumns - The Column instances for creating the actual Header.
        Returns:
        Returns the Header being read.
        Throws:
        IOException - Signals that an I/O exception has occurred.
      • readHeader

        Header<T> readHeader​(Header<T> aHeader)
                      throws IOException
        Creates a Header from the next line to be read. The provided header is matched against the next line being read and ordered accordingly, place holder Column instances are inserted if needed, created by the provided (default) ColumnFactory.
        Parameters:
        aHeader - The Header for creating the actual Header.
        Returns:
        Returns the Header being read.
        Throws:
        IOException - Signals that an I/O exception has occurred.
      • skipHeader

        String skipHeader()
                   throws IOException
        Skips the next line to be read. This line will not be processed by the Iterator.next() method. This methods is useful when skipping the first line (header).
        Returns:
        The line being skipped.
        Throws:
        IOException - thrown in case if IO problems.
      • nextRow

        String[] nextRow()
        Reads the next line from the (standard) input (stream or file) and returns an array of its String representation.
        Specified by:
        nextRow in interface org.refcodes.io.RowReader<T>
        Returns:
        The String array representation of the next Record instance read.
      • nextType

        default <TYPE> TYPE nextType​(Class<TYPE> aClass)
        Reads the next line from the (standard) input (stream or file) and converts it to the given type which's instance is then returned. The Header keys must match the type's properties.
        Type Parameters:
        TYPE - The type of the element to which the line to be read is to be converted to.
        Parameters:
        aClass - the type of the instance to be created.
        Returns:
        The instance of the type to which the Record is being converted to.
      • toHeader

        default Header<T> toHeader​(Header<T> aPrimaryHeader,
                                   Header<T> aSupplementHeader)
        Merges the primary Header with the supplement Header. A copy of the primary Header is returned with any Column replaced in the primary Header with a supplement Header's Column of the same key.
        Parameters:
        aPrimaryHeader - the primary header
        aSupplementHeader - the supplement header
        Returns:
        The accordingly merged Header.