public interface JsonFeeder
JsonParser.
The caller has to take care to only feed as much data as the parser can
process at the time. Use isFull() to determine if the parser
accepts more data. Then call feed(byte) or feed(byte[], int, int)
until there is no more data to feed or until isFull() returns
true. Next call JsonParser.nextEvent() until it returns
JsonEvent.NEED_MORE_INPUT. Repeat feeding and parsing until all
input data has been consumed. Finally, call done() to indicate the
end of the JSON text.| Modifier and Type | Method and Description |
|---|---|
void |
done()
Call this method to indicate that the end of the JSON text has been
reached and that there is no more input to parse.
|
void |
feed(byte b)
Provide more data to the
JsonParser. |
int |
feed(byte[] buf)
Provide more data to the
JsonParser. |
int |
feed(byte[] buf,
int offset,
int len)
Provide more data to the
JsonParser. |
boolean |
hasInput()
Determine if the feeder has input data that can be parsed
|
boolean |
isDone()
Check if the end of the JSON text has been reached
|
boolean |
isFull()
Checks if the parser accepts more input at the moment.
|
char |
nextInput()
Decode and return the next character to be parsed
|
void feed(byte b)
b - the byte to provide as input to the parserjava.lang.IllegalStateException - if the parser does not accept more input at
the moment (see isFull())int feed(byte[] buf)
JsonParser. The method will consume as
many bytes from the input buffer as possible, either until all bytes have
been consumed or until the feeder is full (see isFull()).
The method will return the number of bytes consumed (which can be 0 if the
parser does not accept more input at the moment).buf - the byte array containing the data to consumeisFull())int feed(byte[] buf,
int offset,
int len)
JsonParser. The method will consume as
many bytes from the input buffer as possible, either until len
bytes have been consumed or until the feeder is full (see isFull()).
The method will return the number of bytes consumed (which can be 0 if the
parser does not accept more input at the moment).buf - the byte array containing the data to consumeoffset - the start offset in the byte arraylen - the number of bytes to consumeisFull())boolean isFull()
JsonParser.nextEvent() until it returns
JsonEvent.NEED_MORE_INPUT. Only then new input can be provided
to the parser.void done()
boolean hasInput()
throws java.nio.charset.CharacterCodingException
java.nio.charset.CharacterCodingException - if the input data contains invalid
charactersboolean isDone()
throws java.nio.charset.CharacterCodingException
java.nio.charset.CharacterCodingException - if the input data contains invalid
characterschar nextInput()
throws java.nio.charset.CharacterCodingException
java.lang.IllegalStateException - if there is no input to parsejava.nio.charset.CharacterCodingException - if the input data contains invalid
characters