public class BeanReaderImpl extends Object implements BeanReader
BeanReader implementation.| Constructor and Description |
|---|
BeanReaderImpl(UnmarshallingContext context,
Selector layout)
Constructs a new BeanReaderImpl.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the underlying input stream.
|
void |
debug()
Prints the internal view of the stream configuration
to
System.out |
void |
debug(PrintStream out)
Prints the internal view of the stream configuration.
|
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
BeanReader.read(). |
void |
setIgnoreUnidentifiedRecords(boolean ignoreUnidentifiedRecords)
Sets whether to ignore unidentified records.
|
int |
skip(int count)
Skips ahead in the input stream.
|
public BeanReaderImpl(UnmarshallingContext context, Selector layout)
context - the UnmarshallingContextlayout - the root component of the parser treepublic Object read()
BeanReaderread in interface BeanReaderpublic int skip(int count)
throws BeanReaderIOException,
MalformedRecordException,
UnidentifiedRecordException,
UnexpectedRecordException
BeanReaderskip in interface BeanReadercount - the number of bean objects to skip over that would have been returned
by calling BeanReader.read()BeanReaderIOException - if the underlying input stream throws an
IOException or this reader was closedMalformedRecordException - if the underlying input stream is malformed
and a record could not be accurately skippedUnidentifiedRecordException - if a record could not be identifiedUnexpectedRecordException - if a record is out of sequencepublic void close()
throws BeanReaderIOException
BeanReaderclose in interface BeanReaderBeanReaderIOException - if the underlying input stream throws an
IOException or this reader was already closedpublic String getRecordName()
BeanReadergetRecordName in interface BeanReaderpublic int getLineNumber()
BeanReadergetLineNumber in interface BeanReaderpublic int getRecordCount()
BeanReadergetRecordCount in interface BeanReaderpublic RecordContext getRecordContext(int index)
BeanReaderBeanReader.getRecordCount() can be used
to determine how many records were read from the stream.getRecordContext in interface BeanReaderindex - the index of the record, starting at 0RecordContextBeanReader.getRecordCount()public void setErrorHandler(BeanReaderErrorHandler errorHandler)
BeanReaderBeanReader.read().setErrorHandler in interface BeanReadererrorHandler - the BeanReaderErrorHandlerpublic void setIgnoreUnidentifiedRecords(boolean ignoreUnidentifiedRecords)
ignoreUnidentifiedRecords - true to ignore unidentified records, false otherwisepublic void debug()
DebuggableSystem.outdebug in interface Debuggablepublic void debug(PrintStream out)
Debuggabledebug in interface Debuggableout - the PrintStream to write to