public class NonBlockingJsonParser extends NonBlockingJsonParserBase implements ByteArrayFeeder
NOTE: only supports parsing of UTF-8 encoded content (and 7-bit US-ASCII since it is strict subset of UTF-8): other encodings are not supported.
JsonParser.Feature, JsonParser.NumberType| Constructor and Description |
|---|
NonBlockingJsonParser(IOContext ctxt,
int parserFeatures,
ByteQuadsCanonicalizer sym) |
| Modifier and Type | Method and Description |
|---|---|
void |
endOfInput()
Method that should be called after last chunk of data to parse has been fed
(with
feedInput in sub-class); can be called regardless of what
NonBlockingInputFeeder.needMoreInput()
returns. |
void |
feedInput(byte[] buf,
int start,
int end)
Method that can be called to feed more data, if (and only if)
NonBlockingInputFeeder.needMoreInput() returns true. |
ByteArrayFeeder |
getNonBlockingInputFeeder()
Method that will either return a feeder instance (if parser uses
non-blocking, aka asynchronous access); or
null for
parsers that use blocking I/O. |
boolean |
needMoreInput()
Method called to check whether it is ok to feed more data: parser returns true
if it has no more content to parse (and it is ok to feed more); otherwise false
(and no data should yet be fed).
|
JsonToken |
nextToken()
Main iteration method, which will advance stream enough
to determine type of the next token, if any.
|
int |
releaseBuffered(java.io.OutputStream out)
Method that can be called to push back any content that
has been read but not consumed by the parser.
|
canParseAsync, getBinaryValue, getCodec, getCurrentLocation, getEmbeddedObject, getInputSource, getReadCapabilities, getText, getText, getTextCharacters, getTextLength, getTextOffset, getTokenLocation, getValueAsString, getValueAsString, hasTextCharacters, readBinaryValue, setCodec_getByteArrayBuilder, close, disable, enable, getBigIntegerValue, getCurrentName, getCurrentValue, getDecimalValue, getDoubleValue, getFloatValue, getIntValue, getLongValue, getNumberType, getNumberValue, getNumberValueExact, getParsingContext, getTokenCharacterOffset, getTokenColumnNr, getTokenLineNr, isClosed, isNaN, overrideCurrentName, overrideStdFeatures, setCurrentValue, setFeatureMask, versionclearCurrentToken, currentToken, currentTokenId, getCurrentToken, getCurrentTokenId, getLastClearedToken, getValueAsBoolean, getValueAsDouble, getValueAsInt, getValueAsInt, getValueAsLong, getValueAsLong, hasCurrentToken, hasToken, hasTokenId, isExpectedNumberIntToken, isExpectedStartArrayToken, isExpectedStartObjectToken, nextValue, skipChildrenassignCurrentValue, canReadObjectId, canReadTypeId, canUseSchema, configure, currentLocation, currentName, currentTokenLocation, currentValue, finishToken, getBinaryValue, getBooleanValue, getByteValue, getFeatureMask, getFormatFeatures, getObjectId, getSchema, getShortValue, getTypeId, getValueAsBoolean, getValueAsDouble, isEnabled, isEnabled, nextBooleanValue, nextFieldName, nextFieldName, nextIntValue, nextLongValue, nextTextValue, overrideFormatFeatures, readBinaryValue, readValueAs, readValueAs, readValueAsTree, readValuesAs, readValuesAs, releaseBuffered, requiresCustomCodec, setRequestPayloadOnError, setRequestPayloadOnError, setRequestPayloadOnError, setSchemapublic NonBlockingJsonParser(IOContext ctxt, int parserFeatures, ByteQuadsCanonicalizer sym)
public ByteArrayFeeder getNonBlockingInputFeeder()
JsonParsernull for
parsers that use blocking I/O.getNonBlockingInputFeeder in class JsonParserpublic final boolean needMoreInput()
NonBlockingInputFeederneedMoreInput in interface NonBlockingInputFeederTrue if more input is needed (and can be fed); false if
there is still some input to decodepublic void feedInput(byte[] buf,
int start,
int end)
throws java.io.IOException
ByteArrayFeederNonBlockingInputFeeder.needMoreInput() returns true.feedInput in interface ByteArrayFeederbuf - Byte array that contains data to feed: caller must ensure data remains
stable until it is fully processed (which is true when NonBlockingInputFeeder.needMoreInput()
returns true)start - Offset within array where input data to process startsend - Offset after last byte contained in the input arrayjava.io.IOException - if the state is such that this method should not be called
(has not yet consumed existing input data, or has been marked as closed)public void endOfInput()
NonBlockingInputFeederfeedInput in sub-class); can be called regardless of what
NonBlockingInputFeeder.needMoreInput()
returns. After calling this method, no more data can be fed; and parser assumes
no more data will be available.endOfInput in interface NonBlockingInputFeederpublic int releaseBuffered(java.io.OutputStream out)
throws java.io.IOException
JsonParserreleaseBuffered in class NonBlockingJsonParserBaseout - OutputStream to which buffered, undecoded content is written toOutputStream;
otherwise number of bytes released (0 if there was nothing to release)java.io.IOException - if write to stream threw exceptionpublic JsonToken nextToken() throws java.io.IOException
JsonParsernextToken in class ParserMinimalBasejava.io.IOException - for low-level read issues, or
JsonParseException for decoding problemsCopyright © 2010 - 2023 Adobe. All Rights Reserved