|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jmonks.batch.io.FileWriter
org.jmonks.batch.io.flat.FlatFileWriter
FlatFileWriter writes/generates the file according to the given file spec with the data submitted in the form of WriterRecord's. This provides the methods to create the required writer records and write the writer record into the file writer. Once finished writing of all the records file writer should be closed by calling the "close" method.
Nested Class Summary | |
class |
FlatFileWriter.FlatFileWriterRecord
FixedWidthFlatFileWriterRecord implements WriterRecord by maintaing the field names and values as a map and provides the methods with proper access privileges to read into and write from the record. |
Field Summary | |
protected FileSpec |
fileSpec
File spec to be used in writing the file. |
Constructor Summary | |
FlatFileWriter(java.io.OutputStream outputStream,
FileSpec fileSpec)
Constructs and initializes the writer with the given values. |
|
FlatFileWriter(java.io.Writer writer,
FileSpec fileSpec)
Constructs and initializes the writer with the given values. |
Method Summary | |
void |
close()
Closes the writer and all the resource being used by this writer. |
WriterRecord |
createWriterRecord(RecordType recordType)
Creates the writer record assocites with the given record type. |
protected abstract java.lang.String |
generateRecord(WriterRecord writerRecord)
Generates the string representation of the record from given writer record. |
void |
writeRecord(WriterRecord writerRecord)
Writes the given record into the file/writer. |
Methods inherited from class org.jmonks.batch.io.FileWriter |
getFileWriter, getFileWriter, getFileWriter, getFileWriter |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected FileSpec fileSpec
Constructor Detail |
public FlatFileWriter(java.io.OutputStream outputStream, FileSpec fileSpec)
outputStream
- Output stream to write the records.fileSpec
- File spec to be used to generate the file.public FlatFileWriter(java.io.Writer writer, FileSpec fileSpec)
writer
- Writer to write the records.fileSpec
- File spec to be used to generate the file.Method Detail |
public WriterRecord createWriterRecord(RecordType recordType)
createWriterRecord
in class FileWriter
recordType
- Type fo the record to be created.
java.lang.IllegalArgumentException
- No record spec is found with this record type.protected abstract java.lang.String generateRecord(WriterRecord writerRecord) throws java.io.IOException
writerRecord
- Record where field values can be read.
java.io.IOException
public void writeRecord(WriterRecord writerRecord)
writeRecord
in class FileWriter
writerRecord
- Record consist of field names and values.
java.lang.IllegalStateException
- If writer is closed and trying to write the recrod.
java.lang.IllegalArgumentException
- If writer record is null.
FileParseException
- Problems while trying to write the record.public void close()
close
in class FileWriter
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |