Class CsvRawReader


  • public class CsvRawReader
    extends java.lang.Object
    This class is a helper class that handles the reading and parsing of data from a .csv file.
    Author:
    Jonathan Ackerman, Sander Brienen, Stuart Mottram (fritto), Jason Bedell, Tomasz Skutnik, Christoph Langer, Chetan Gupta
    • Constructor Summary

      Constructors 
      Constructor Description
      CsvRawReader​(java.io.LineNumberReader in, java.lang.String tableName, java.lang.String tableAlias, java.lang.String separator, boolean suppressHeaders, boolean isHeaderFixedWidth, java.lang.Character quoteChar, java.lang.String comment, java.lang.String headerLine, boolean trimHeaders, boolean trimValues, int skipLeadingLines, boolean ignoreUnparseableLines, java.lang.String missingValue, boolean defectiveHeaders, int skipLeadingDataLines, java.lang.String quoteStyle, java.util.ArrayList<int[]> fixedWidthColumns)  
    • Constructor Detail

      • CsvRawReader

        public CsvRawReader​(java.io.LineNumberReader in,
                            java.lang.String tableName,
                            java.lang.String tableAlias,
                            java.lang.String separator,
                            boolean suppressHeaders,
                            boolean isHeaderFixedWidth,
                            java.lang.Character quoteChar,
                            java.lang.String comment,
                            java.lang.String headerLine,
                            boolean trimHeaders,
                            boolean trimValues,
                            int skipLeadingLines,
                            boolean ignoreUnparseableLines,
                            java.lang.String missingValue,
                            boolean defectiveHeaders,
                            int skipLeadingDataLines,
                            java.lang.String quoteStyle,
                            java.util.ArrayList<int[]> fixedWidthColumns)
                     throws java.io.IOException,
                            java.sql.SQLException
        Throws:
        java.io.IOException
        java.sql.SQLException
    • Method Detail

      • next

        public boolean next()
                     throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • close

        public void close()
      • getNextDataLine

        protected java.lang.String getNextDataLine()
                                            throws java.io.IOException
        Returns:
        The first next data line that contains the correct amount of columns. An amount of column is considered correct if it matches columnNames or if no columnNames is given and the amount is more than 1.
        Throws:
        java.io.IOException - if reading next line fails.
      • getLineNumber

        public int getLineNumber()
      • getColumnNames

        public java.lang.String[] getColumnNames()
        Gets the columnNames attribute of the CsvReader object.
        Returns:
        The columnNames value.
      • getColumnSizes

        public int[] getColumnSizes()
      • getTableName

        public java.lang.String getTableName()
      • getTableAlias

        public java.lang.String getTableAlias()
      • getFieldValues

        public java.lang.String[] getFieldValues()
      • getField

        public java.lang.String getField​(int columnIndex)
        Get the value of the column at the specified index, 0 based.
        Parameters:
        columnIndex - Description of Parameter.
        Returns:
        The column value.
      • parseLine

        protected java.lang.String[] parseLine​(java.lang.String line,
                                               boolean trimValues)
                                        throws java.sql.SQLException
        Throws:
        java.sql.SQLException