public class DelimitedReader extends java.lang.Object
| Constructor and Description |
|---|
DelimitedReader(java.io.InputStream dataStream,
int numCols,
java.lang.String delimiter,
int numHeaderLines,
java.lang.String lineEnding,
int numRecords,
boolean stripHeader)
This constructor will read delimitered data from stream rather a string
|
DelimitedReader(java.lang.String data,
int numCols,
java.lang.String delimiter,
int numHeaderLines,
java.lang.String lineEnding,
int numRecords,
boolean isLenient)
constructor. reads the csv stream.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Vector |
getRowDataVectorFromStream()
This method is from data source as a input stream This method will read
one row from and return a data vector which element is String and the
value is field data.
|
java.util.Vector[] |
getTokenizedData(boolean stripHeaderLines)
returns the data as an array of vectors. each vector will have the same
number of elements as there are columns in the data.
|
boolean |
isLenient() |
void |
setCollapseDelimiter(boolean collapseDelimiter)
Method to set up collapseDelimiter.
|
void |
setInputStream(java.io.InputStream dataStream)
Method to set up data stream as source
|
void |
setLenient(boolean isLenient) |
void |
setNumFooterLines(int numFooterLines)
Set up the footer line number.
|
java.lang.String |
toString()
returns a string representation of the data
|
static java.lang.String |
unescapeDelimiter(java.lang.String delimiter)
Convert a string escaped representation of a delimiter character into an
the actual String for that delimiter.
|
public DelimitedReader(java.lang.String data, int numCols, java.lang.String delimiter, int numHeaderLines, java.lang.String lineEnding, int numRecords, boolean isLenient) throws java.lang.Exception
delimString - the delimited stream to readnumCols - the number of columns in the streamdelimiter - the delimiter to tokenize onnumHeaderLines - the number of lines to skip at the top of the filelineEnding - the line ending char(s)...either "\n"lo (unix),isLenient - specifies if extra columns should be ignored "\r\n" (windoze)
or "\r" (mac)java.lang.Exceptionpublic DelimitedReader(java.io.InputStream dataStream, int numCols, java.lang.String delimiter, int numHeaderLines, java.lang.String lineEnding, int numRecords, boolean stripHeader)
dataStream - InputStream The input streamnumCols - int the number of columnsdelimiter - String delimiter the delimiter to tokenize onnumHeaderLines - int numHeaderLines the number of lines to skip at the top of
the filelineEnding - String lineEnding the line ending char(s)...either "\n"
(unix),"\r\n" (windoze) or "\r" (mac)numRecords - int number of rows in the input streampublic void setInputStream(java.io.InputStream dataStream)
dataStream - InputStreampublic void setCollapseDelimiter(boolean collapseDelimiter)
collapseDelimiter - public void setNumFooterLines(int numFooterLines)
numFooterLines - public boolean isLenient()
public void setLenient(boolean isLenient)
public java.util.Vector getRowDataVectorFromStream() throws java.lang.Exception
java.lang.Exceptionpublic java.util.Vector[] getTokenizedData(boolean stripHeaderLines)
stripHeaderLines - true if the header lines should not be included in the
returned data, false otherwisepublic java.lang.String toString()
toString in class java.lang.Objectpublic static java.lang.String unescapeDelimiter(java.lang.String delimiter)
delimiter - the String representing the delimiter