|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.jdbcexporter.formatter.FixedDelimiterFormatter
The FixedDelimiterFormatter class implements the DelimiterFormatter interface to format column values in a fixed file format. Each column value is placed into 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 java.io.Writer |
writer
The output writer. |
Constructor Summary | |
FixedDelimiterFormatter()
|
Method Summary | |
void |
finish()
Finishs the writing of rows to the output source. |
java.lang.String |
formatValues(ColumnValue[] values)
Creates a string representing the row of column values. |
void |
setColumnPositions(int[][] positions)
Sets the number range for each column value. |
void |
setLength(int len)
Sets the length of each row. |
void |
setWriter(java.io.Writer output)
Sets the output source for the formatter. |
void |
writeNextRow(java.lang.String row)
Writes the next row to the output source. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.io.Writer writer
protected int[][] columnPositions
protected int length
Constructor Detail |
public FixedDelimiterFormatter()
Method Detail |
public void setColumnPositions(int[][] positions)
setColumnPositions( new int[][] { { 1, 5 }, { 16, 20 }, { 6, 15 } } )This will setup the FixedDelimiterFormatter to format three column values: the first column value will be stored from the 1st character to the 5th character, the second column value will be stored from the 15th character to the 20th character, and the last column value will be 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 setWriter(java.io.Writer output)
DelimiterFormatter
setWriter
in interface DelimiterFormatter
output
- the destination of the dataDelimiterFormatter.setWriter(java.io.Writer)
public java.lang.String formatValues(ColumnValue[] values)
DelimiterFormatter
formatValues
in interface DelimiterFormatter
values
- the column values
DelimiterFormatter.formatValues(net.sourceforge.jdbcimporter.ColumnValue[])
public void writeNextRow(java.lang.String row) throws java.io.IOException
DelimiterFormatter
writeNextRow
in interface DelimiterFormatter
row
- the next row
java.io.IOException
- if an error occurs while writing the next rowDelimiterFormatter.writeNextRow(java.lang.String)
public void finish() throws java.io.IOException
DelimiterFormatter
finish
in interface DelimiterFormatter
java.io.IOException
DelimiterFormatter.finish()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |