Arch4J 1.1

org.arch4j.parse
Interface InputRecordHandler

All Known Implementing Classes:
DelimitedRecordReaderTest.TestRecordHandler, FixedRecordReaderTest.TestRecordHandler

public interface InputRecordHandler

This interface must be implemented by any class wishing to handle incoming records from a RecordReader class.

Version:
1.0
Author:
Russ Brown

Method Summary
 void end()
          this method is called by the record reader after the last record has been read, when the end of the stream is reached.
 void error(int recordNumber, String errorMsg, String[] rawData)
          this method is called by the record reader when it is unable to read a record into a record object.
 boolean newRecord(int recordNumber, RecordData newRecord, String[] rawData)
          this method is called by the reader each time a record is successfully read and loaded into an RecordData object.
 void start()
          this method is called by the record reader before reading the first record.
 

Method Detail

start

public void start()
this method is called by the record reader before reading the first record.


newRecord

public boolean newRecord(int recordNumber,
                         RecordData newRecord,
                         String[] rawData)
                  throws RecordDataInputException
this method is called by the reader each time a record is successfully read and loaded into an RecordData object. If the raw data cannot be converted to a record object, the RecordReader will add the record to an edit (reject) file with an appriate message about the cause. If the record is created successfully, but the handler throws an RecordDataInputException, the record is added to the edit stream, along with the information provided in the exception.

Parameters:
recordNumber - sequential number assigned to each record, whether it failed or succeeded, starting at 1 for the first record in the stream.
newRecord - record object containg data values read for this record.
rawData - text data from input file used to create this record.
Returns:
true if the parser should continue parsing records.
Throws:
RecordDataInputException - if record handling failed.

error

public void error(int recordNumber,
                  String errorMsg,
                  String[] rawData)
this method is called by the record reader when it is unable to read a record into a record object.

Parameters:
recordNumber - sequential number assigned to each record, whether it failed or succeeded, starting at 1 for the first record in the stream.
errorMsg - descriprtion of the error that occured.
rawData - text data from the input stream which failed to produce a record.

end

public void end()
this method is called by the record reader after the last record has been read, when the end of the stream is reached.


Arch4J 1.1

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