public class DefaultJsonFeeder extends java.lang.Object implements JsonFeeder
JsonFeeder used internally by
the JsonParser.| Constructor and Description |
|---|
DefaultJsonFeeder(java.nio.charset.Charset charset)
Constructs a feeder
|
DefaultJsonFeeder(java.nio.charset.Charset charset,
int capacity)
Constructs a feeder
|
| 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
|
public DefaultJsonFeeder(java.nio.charset.Charset charset)
charset - the charset that should be used to decode input datapublic DefaultJsonFeeder(java.nio.charset.Charset charset,
int capacity)
charset - the charset that should be used to decode input datacapacity - the capacity of the internal byte buffer caching input datapublic void feed(byte b)
JsonFeederfeed in interface JsonFeederb - the byte to provide as input to the parserpublic int feed(byte[] buf)
JsonFeederJsonParser. 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 JsonFeeder.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).feed in interface JsonFeederbuf - the byte array containing the data to consumeJsonFeeder.isFull())public int feed(byte[] buf,
int offset,
int len)
JsonFeederJsonParser. 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 JsonFeeder.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).feed in interface JsonFeederbuf - the byte array containing the data to consumeoffset - the start offset in the byte arraylen - the number of bytes to consumeJsonFeeder.isFull())public void done()
JsonFeederdone in interface JsonFeederpublic boolean isFull()
JsonFeederJsonParser.nextEvent() until it returns
JsonEvent.NEED_MORE_INPUT. Only then new input can be provided
to the parser.isFull in interface JsonFeederpublic boolean hasInput()
throws java.nio.charset.CharacterCodingException
JsonFeederhasInput in interface JsonFeederjava.nio.charset.CharacterCodingException - if the input data contains invalid
characterspublic boolean isDone()
throws java.nio.charset.CharacterCodingException
JsonFeederisDone in interface JsonFeederjava.nio.charset.CharacterCodingException - if the input data contains invalid
characterspublic char nextInput()
throws java.nio.charset.CharacterCodingException
JsonFeedernextInput in interface JsonFeederjava.nio.charset.CharacterCodingException - if the input data contains invalid
characters