org.relique.jdbc.csv
Class CsvRawReader

java.lang.Object
  extended by org.relique.jdbc.csv.CsvRawReader

public class CsvRawReader
extends 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
CsvRawReader(LineNumberReader in, String tableName, String tableAlias, String separator, boolean suppressHeaders, boolean isHeaderFixedWidth, Character quoteChar, String comment, String headerLine, boolean trimHeaders, boolean trimValues, int skipLeadingLines, boolean ignoreUnparseableLines, String missingValue, boolean defectiveHeaders, int skipLeadingDataLines, String quoteStyle, ArrayList<int[]> fixedWidthColumns)
           
 
Method Summary
 void close()
           
 String[] getColumnNames()
          Gets the columnNames attribute of the CsvReader object.
 int[] getColumnSizes()
           
 String getField(int columnIndex)
          Get the value of the column at the specified index, 0 based.
 String[] getFieldValues()
           
 int getLineNumber()
           
protected  String getNextDataLine()
           
 String getTableAlias()
           
 String getTableName()
           
 boolean next()
           
protected  String[] parseLine(String line, boolean trimValues)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CsvRawReader

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

next

public boolean next()
             throws SQLException
Throws:
SQLException

close

public void close()

getNextDataLine

protected String getNextDataLine()
                          throws 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:
IOException - if reading next line fails.

getLineNumber

public int getLineNumber()

getColumnNames

public String[] getColumnNames()
Gets the columnNames attribute of the CsvReader object.

Returns:
The columnNames value.

getColumnSizes

public int[] getColumnSizes()

getTableName

public String getTableName()

getTableAlias

public String getTableAlias()

getFieldValues

public String[] getFieldValues()

getField

public 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 String[] parseLine(String line,
                             boolean trimValues)
                      throws SQLException
Throws:
SQLException


Copyright © 2016. All rights reserved.