Arch4J 1.1

org.arch4j.parse
Class RecordWriter

java.lang.Object
  |
  +--org.arch4j.parse.RecordWriter
Direct Known Subclasses:
DelimitedRecordWriter

public abstract class RecordWriter
extends Object


Field Summary
static String DATA_TYPE_DATE
           
static String DATA_TYPE_NUMBER
           
static String DATA_TYPE_TEXT
           
static String DEFAULT_CLOSE_BRACKET
          Used to bound the end of output text.
static String DEFAULT_OPEN_BRACKET
          Used to bound the beginning of output text.
protected  ReadOnlyProperty format
          property tree, describes output record format.
protected  BufferedWriter writer
           
 
Method Summary
 void close()
          close down the writer and flush all the data to the underlying output stream.
protected  String convertObjectToText(Object value, String aDateFormat)
           
protected abstract  String[] createRawData(RecordData record)
          create a record ready to go out to the ouput stream from an RecordData object.
 void flush()
          flush any buffered contents to the stream.
protected abstract  void initFormatData()
           
 void setFormat(ReadOnlyProperty formatProps)
          provide the reader with the property tree that defines the format of the files it must read.
 void write(RecordData record)
          read raw data records from an input stream, convert them to (@link RecordData} objects using the format properties, and notify the handler provided.
 void writeDateRecord(Date date, String format)
           
protected  void writeRawData(String[] rawBuffer)
          write a set of strings representing a record out to the ouput stream.
 void writeRecord(String formattedRecord)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATA_TYPE_TEXT

public static final String DATA_TYPE_TEXT
See Also:
Constant Field Values

DATA_TYPE_DATE

public static final String DATA_TYPE_DATE
See Also:
Constant Field Values

DATA_TYPE_NUMBER

public static final String DATA_TYPE_NUMBER
See Also:
Constant Field Values

DEFAULT_OPEN_BRACKET

public static final String DEFAULT_OPEN_BRACKET
Used to bound the beginning of output text.

See Also:
Constant Field Values

DEFAULT_CLOSE_BRACKET

public static final String DEFAULT_CLOSE_BRACKET
Used to bound the end of output text.

See Also:
Constant Field Values

format

protected ReadOnlyProperty format
property tree, describes output record format.


writer

protected BufferedWriter writer
Method Detail

setFormat

public void setFormat(ReadOnlyProperty formatProps)
               throws FormatException
provide the reader with the property tree that defines the format of the files it must read.

Parameters:
formatProps - property tree defining output file format. See subclass implementations.
FormatException

write

public void write(RecordData record)
           throws IOException
read raw data records from an input stream, convert them to (@link RecordData} objects using the format properties, and notify the handler provided. Send any edit/reject reject records to the specified reject stream.

IOException

writeRecord

public void writeRecord(String formattedRecord)

writeDateRecord

public void writeDateRecord(Date date,
                            String format)

flush

public void flush()
           throws IOException
flush any buffered contents to the stream.

IOException

close

public void close()
           throws IOException
close down the writer and flush all the data to the underlying output stream. This does not close the output stream.

IOException

createRawData

protected abstract String[] createRawData(RecordData record)
create a record ready to go out to the ouput stream from an RecordData object. Format based on the properties provided to the setFormat(org.arch4j.propertytree.ReadOnlyProperty) method.

Parameters:
record - the record object to be converted to Strings.
Returns:
String representation of record.

writeRawData

protected void writeRawData(String[] rawBuffer)
write a set of strings representing a record out to the ouput stream.

Parameters:
rawBuffer - raw data to send to output file.

initFormatData

protected abstract void initFormatData()
                                throws FormatException
FormatException

convertObjectToText

protected String convertObjectToText(Object value,
                                     String aDateFormat)

Arch4J 1.1

Copyright © 2000-2004 SpiderLogic, a service of Wipfli Ullrich Bertelson LLP.