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 UnmarshallingContext
layout
- the root component of the parser treepublic Object read()
BeanReader
read
in interface BeanReader
public int skip(int count) throws BeanReaderIOException, MalformedRecordException, UnidentifiedRecordException, UnexpectedRecordException
BeanReader
skip
in interface BeanReader
count
- 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
BeanReader
close
in interface BeanReader
BeanReaderIOException
- if the underlying input stream throws an
IOException
or this reader was already closedpublic String getRecordName()
BeanReader
getRecordName
in interface BeanReader
public int getLineNumber()
BeanReader
getLineNumber
in interface BeanReader
public int getRecordCount()
BeanReader
getRecordCount
in interface BeanReader
public RecordContext getRecordContext(int index)
BeanReader
BeanReader.getRecordCount()
can be used
to determine how many records were read from the stream.getRecordContext
in interface BeanReader
index
- the index of the record, starting at 0RecordContext
BeanReader.getRecordCount()
public void setErrorHandler(BeanReaderErrorHandler errorHandler)
BeanReader
BeanReader.read()
.setErrorHandler
in interface BeanReader
errorHandler
- the BeanReaderErrorHandler
public void setIgnoreUnidentifiedRecords(boolean ignoreUnidentifiedRecords)
ignoreUnidentifiedRecords
- true to ignore unidentified records, false otherwisepublic void debug()
Debuggable
System.out
debug
in interface Debuggable
public void debug(PrintStream out)
Debuggable
debug
in interface Debuggable
out
- the PrintStream
to write to