net.sf.flatpack.writer
Class AbstractWriter
java.lang.Object
net.sf.flatpack.writer.AbstractWriter
- All Implemented Interfaces:
- Writer
- Direct Known Subclasses:
- DelimiterWriter, FixedLengthWriter
public abstract class AbstractWriter
- extends java.lang.Object
- implements Writer
This class encapsulates the writer that's used to output the data.
-

|
Method Summary |
void |
addRecordEntry(java.lang.String columnName,
java.lang.Object value)
|
void |
close()
|
void |
flush()
|
protected java.util.Map |
getRowMap()
|
void |
nextRecord()
Writes a newline to the output and discards the rowMap. |
protected abstract boolean |
validateColumnTitle(java.lang.String columnTitle)
Subclasses must implement this method to perform validation of
columnTitle. |
protected void |
write(char character)
|
protected void |
write(char[] characters)
|
protected void |
write(java.lang.Object value)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractWriter
public AbstractWriter(java.io.Writer output)
addRecordEntry
public void addRecordEntry(java.lang.String columnName,
java.lang.Object value)
- Specified by:
addRecordEntry in interface Writer
validateColumnTitle
protected abstract boolean validateColumnTitle(java.lang.String columnTitle)
- Subclasses must implement this method to perform validation of
columnTitle.
- Parameters:
columnTitle - title of the column to be filled
- Returns:
true if the column title is valid else return
false.
nextRecord
public void nextRecord()
throws java.io.IOException
- Writes a newline to the output and discards the
rowMap.
This method must be overridden by subclasses to write out the record data
stored in rowMap. Overriders must call
super.nextRecord() as the last call in their implementation.
- Specified by:
nextRecord in interface Writer
- Throws:
java.io.IOException
write
protected void write(java.lang.Object value)
throws java.io.IOException
- Throws:
java.io.IOException
write
protected void write(char character)
throws java.io.IOException
- Throws:
java.io.IOException
write
protected void write(char[] characters)
throws java.io.IOException
- Throws:
java.io.IOException
flush
public void flush()
throws java.io.IOException
- Specified by:
flush in interface Writer
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close in interface Writer
- Throws:
java.io.IOException
getRowMap
protected java.util.Map getRowMap()