|
BeanIO 2.0.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface BeanReader
Interface for unmarshalling bean objects from an input stream.
A BeanReader is created using a StreamFactory
and a mapping file.
StreamFactory
Method Summary | |
---|---|
void |
close()
Closes the underlying input stream. |
int |
getLineNumber()
Returns the starting line number of the first record for the most recent bean object read from this reader, or -1 when the end of the stream is reached. |
RecordContext |
getRecordContext(int index)
Returns record information for the most recent bean object read from this reader. |
int |
getRecordCount()
Returns the number of records read from the underlying input stream for the most recent bean object read from this reader. |
String |
getRecordName()
Returns the record or group name of the most recent bean object read from this reader, or null if the end of the stream was reached. |
Object |
read()
Reads a single bean from the input stream. |
void |
setErrorHandler(BeanReaderErrorHandler errorHandler)
Sets the error handler to handle exceptions thrown by read() . |
int |
skip(int count)
Skips ahead in the input stream. |
Method Detail |
---|
Object read() throws BeanReaderIOException, MalformedRecordException, UnidentifiedRecordException, UnexpectedRecordException, InvalidRecordException
BeanReaderIOException
- if the underlying input stream throws an
IOException
or this reader was closed
MalformedRecordException
- if the underlying input stream is malformed
and the record could not be accurately read
UnidentifiedRecordException
- if the record type could not be identified
UnexpectedRecordException
- if the record type is out of sequence
InvalidRecordException
- if the record was identified and failed record
or field level validations (including field type conversion errors)int skip(int count) throws BeanReaderIOException, MalformedRecordException, UnidentifiedRecordException, UnexpectedRecordException
count
- the number of bean objects to skip over that would have been returned
by calling read()
BeanReaderIOException
- if the underlying input stream throws an
IOException
or this reader was closed
MalformedRecordException
- if the underlying input stream is malformed
and a record could not be accurately skipped
UnidentifiedRecordException
- if a record could not be identified
UnexpectedRecordException
- if a record is out of sequenceString getRecordName()
int getLineNumber()
int getRecordCount()
RecordContext getRecordContext(int index) throws IndexOutOfBoundsException
getRecordCount()
can be used
to determine how many records were read from the stream.
index
- the index of the record, starting at 0
RecordContext
IndexOutOfBoundsException
- if there is no record for the given indexgetRecordCount()
void close() throws BeanReaderIOException
BeanReaderIOException
- if the underlying input stream throws an
IOException
or this reader was already closedvoid setErrorHandler(BeanReaderErrorHandler errorHandler)
read()
.
errorHandler
- the BeanReaderErrorHandler
|
BeanIO 2.0.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |