com.blackbear.flatworm
Class FileFormat

java.lang.Object
  extended by com.blackbear.flatworm.FileFormat

public class FileFormat
extends java.lang.Object

The FileFormat is the point of entry into the Flatworm parser. It is generated from the XML Flatworm description, and can then be used to read a line or lines from a file, determine if there is a matching record definition for the line(s), and return a HashMap with the beans created by parsing the input.


Constructor Summary
FileFormat()
           
 
Method Summary
 void addConverter(com.blackbear.flatworm.Converter converter)
          Facilitates the storage of multiple converters.
 void addRecord(com.blackbear.flatworm.Record r)
           
 ConversionHelper getConvertionHelper()
          FileFormat is the keeper of ConversionHelper, but does not actually use it.
 java.lang.String getLastLine()
           
 MatchedRecord getNextRecord(java.io.BufferedReader in)
          When called with a BufferedReader, reads sufficient lines to parse a record, and returns the beans created.
 com.blackbear.flatworm.Record getRecord(java.lang.String name)
           
 java.util.HashMap getRecords()
           
 void setRecords(java.util.HashMap records)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileFormat

public FileFormat()
Method Detail

getLastLine

public java.lang.String getLastLine()

getRecords

public java.util.HashMap getRecords()

setRecords

public void setRecords(java.util.HashMap records)

addRecord

public void addRecord(com.blackbear.flatworm.Record r)

getRecord

public com.blackbear.flatworm.Record getRecord(java.lang.String name)

addConverter

public void addConverter(com.blackbear.flatworm.Converter converter)
Facilitates the storage of multiple converters. However, actual storage is delegated to the COnversionHelper class.

Parameters:
Converter - converter to store

getConvertionHelper

public ConversionHelper getConvertionHelper()
FileFormat is the keeper of ConversionHelper, but does not actually use it. This allows access

Returns:
ConversionHelper

getNextRecord

public MatchedRecord getNextRecord(java.io.BufferedReader in)
                            throws FlatwormInvalidRecordException,
                                   FlatwormInputLineLengthException,
                                   FlatwormConversionException,
                                   FlatwormUnsetFieldValueException
When called with a BufferedReader, reads sufficient lines to parse a record, and returns the beans created.

Parameters:
in - The stream to read from
Returns:
The created beans in a MatchedRecord object
Throws:
FlatwormInvalidRecordException
FlatwormInputLineLengthException
FlatwormConversionException
FlatwormUnsetFieldValueException