Package com.amazon.ion.impl
Interface ReaderLookaheadBuffer
-
- All Known Implementing Classes:
IonReaderLookaheadBuffer
public interface ReaderLookaheadBufferInterface for lookahead buffers that enable incremental reading of streaming data.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intavailable()Indicates how many bytes are currently stored in the internal buffer.voidfillInput()If possible, fills the input pipe with enough bytes to enable one more successful call toIonReader.next()on the non-incremental reader attached to the pipe.booleanmoreDataRequired()Indicates whether more data must become present in the raw input stream before a successful call toIonReader.next()may be made to position the reader on the most-recently-buffered value.IonReadernewIonReader(IonReaderBuilder builder)Builds a reader over the input pipe.
-
-
-
Method Detail
-
fillInput
void fillInput() throws java.lang.ExceptionIf possible, fills the input pipe with enough bytes to enable one more successful call toIonReader.next()on the non-incremental reader attached to the pipe. If not enough bytes were available in the raw input stream to complete the next top-level user value, callingmoreDataRequired()after this method returns will return `true`. In this case, this method must be called again before calling `IonReader.next()` to position the reader on this value. Otherwise, `moreDataRequired()` will return `false` and a call to `IonReader.next()` may be made to position the reader on this value. Implementations may throw `IonException` if invalid Ion data is detected. Implementations may define exceptional cases.- Throws:
java.lang.Exception- if an IOException is thrown by the underlying InputStream.
-
moreDataRequired
boolean moreDataRequired()
Indicates whether more data must become present in the raw input stream before a successful call toIonReader.next()may be made to position the reader on the most-recently-buffered value.- Returns:
- true if more data is required to complete the next top-level user value; otherwise, false.
-
available
int available()
Indicates how many bytes are currently stored in the internal buffer. This can be used to detect whether calls to fillInput() are successfully retrieving data.- Returns:
- The number of bytes waiting in the input buffer.
-
newIonReader
IonReader newIonReader(IonReaderBuilder builder)
Builds a reader over the input pipe. NOTE: because IonReader construction consumes bytes from the stream (to determine whether the stream is binary or text Ion),fillInput()must have been called (such thatmoreDataRequired()returns `false`) before calling this method. For the same reason, this method must only be called once per instance of this class.- Parameters:
builder- the builder containing the reader's configuration.- Returns:
- a new IonReader.
-
-