public interface InputStreamInterceptor
IonReaderBuilder when creating an
IonReader over a user-provided stream. This allows users to transform a stream's raw bytes into
valid text or binary Ion.| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
formatName()
The name of the format the interceptor recognizes.
|
boolean |
isMatch(byte[] candidate,
int offset,
int length)
Determines whether the given candidate byte sequence matches this format.
|
java.io.InputStream |
newInputStream(java.io.InputStream interceptedStream)
Creates a new InputStream that transforms the bytes in the given InputStream into valid text or binary Ion.
|
int |
numberOfBytesNeededToDetermineMatch()
The number of bytes required to be read from the beginning of the stream in order to determine whether
it matches the format relevant to this interceptor.
|
java.lang.String formatName()
int numberOfBytesNeededToDetermineMatch()
isMatch(byte[], int, int) will not be called.boolean isMatch(byte[] candidate,
int offset,
int length)
candidate - the candidate byte sequence.offset - the offset into the candidate bytes to begin matching.length - the number of bytes (beginning at 'offset') in `candidate`. Must be greater than or equal to
numberOfBytesNeededToDetermineMatch().java.io.InputStream newInputStream(java.io.InputStream interceptedStream)
throws java.io.IOException
interceptedStream - the stream containing bytes in this format.java.io.IOException - if thrown when constructing the new InputStream.