|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.jdbcimporter.parser.FixedDelimiterParser
The FixedDelimiterParser class implements the DelimiterParser interface to parse column values from a fixed file format. Each column value is taken from a section of the line (specified by the columnPositions property).
Field Summary | |
protected int[][] |
columnPositions
The number range for each column. |
protected int |
length
The length of each row in the file. |
protected static org.apache.commons.logging.Log |
LOG
The log for debug information. |
protected java.io.BufferedReader |
reader
The input reader. |
Constructor Summary | |
FixedDelimiterParser()
|
Method Summary | |
java.lang.String |
getNextRow()
Returns the next row to be imported as a String. |
ColumnValue[] |
getValues(java.lang.String nextRow)
Returns the column values for the row specified. |
void |
setColumnPositions(int[][] positions)
Sets the number range for each column value. |
void |
setLength(int len)
Sets the length of each row. |
void |
setReader(java.io.Reader input)
Sets the input source for the parser. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static org.apache.commons.logging.Log LOG
protected java.io.BufferedReader reader
protected int[][] columnPositions
protected int length
Constructor Detail |
public FixedDelimiterParser()
Method Detail |
public void setColumnPositions(int[][] positions)
setColumnPositions( new int[][] { { 1, 5 }, { 16, 20 }, { 6, 15 } } )This will setup the FixedDelimiterParser to parse three column values: the first column value is stored from the 1st character to the 5th character, the second column value is stored from the 15th character to the 20th character, and the last column value is stored from the 6th character to the 15th character.
positions
- The number ranges for all column valuespublic void setLength(int len)
len
- the lengthpublic void setReader(java.io.Reader input)
DelimiterParser
setReader
in interface DelimiterParser
input
- the source of the data to import.DelimiterParser.setReader(Reader)
public java.lang.String getNextRow() throws java.io.IOException
DelimiterParser
getNextRow
in interface DelimiterParser
java.io.IOException
- if an error occurs while retrieving the next rowDelimiterParser.getNextRow()
public ColumnValue[] getValues(java.lang.String nextRow) throws MalformedDataException
DelimiterParser
getValues
in interface DelimiterParser
nextRow
- the row to be parsed into column values
MalformedDataException
- if the row is not formatted properlyDelimiterParser.getValues(String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |