net.sf.flatpack.writer
Class AbstractWriter

java.lang.Object
  extended by 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.

Author:
Dirk Holmes and Holger Holger Hoffstatte

Constructor Summary
AbstractWriter(java.io.Writer output)
           
 
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 val)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.flatpack.writer.Writer
printFooter, printHeader
 

Constructor Detail

AbstractWriter

public AbstractWriter(java.io.Writer output)
Method Detail

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 val)
              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()


Copyright © 2006-2011 Appendium - Portfolio Financing Platform. All Rights Reserved.