public final class UTF8StreamJsonParser extends ParserBase
JacksonParser, which is
based on a InputStream as the input source.JacksonParser.Feature, JacksonParser.NumberType| 构造器和说明 |
|---|
UTF8StreamJsonParser(IOContext ctxt,
int features,
InputStream in,
ObjectCodec codec,
BytesToNameCanonicalizer sym,
byte[] inputBuffer,
int start,
int end,
boolean bufferRecyclable) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close()
Closes the parser so that no further iteration or data access
can be made; will also close the underlying input source
if parser either owns the input source, or feature
JacksonParser.Feature.AUTO_CLOSE_SOURCE is enabled. |
byte[] |
getBinaryValue(Base64Variant b64variant)
Method that can be used to read (and consume -- results
may not be accessible using other methods after the call)
base64-encoded binary data
included in the current textual JSON value.
|
ObjectCodec |
getCodec()
Accessor for
ObjectCodec associated with this
parser, if any. |
Object |
getEmbeddedObject()
Accessor that can be called if (and only if) the current token
is
JsonToken.VALUE_EMBEDDED_OBJECT. |
Object |
getInputSource()
Method that can be used to get access to object that is used
to access input being parsed; this is usually either
InputStream or Reader, depending on what
parser was constructed with. |
String |
getText()
Method for accessing textual representation of the current token;
if no current token (before first call to
JacksonParser.nextToken(), or
after encountering end-of-input), returns null. |
char[] |
getTextCharacters()
Method similar to
JacksonParser.getText(), but that will return
underlying (unmodifiable) character array that contains
textual value, instead of constructing a String object
to contain this information. |
int |
getTextLength()
Accessor used with
JacksonParser.getTextCharacters(), to know length
of String stored in returned buffer. |
int |
getTextOffset()
Accessor used with
JacksonParser.getTextCharacters(), to know offset
of the first text content character within buffer. |
static int[] |
growArrayBy(int[] arr,
int more) |
Boolean |
nextBooleanValue()
Method that fetches next token (as if calling
JacksonParser.nextToken()) and
if it is JsonToken.VALUE_TRUE or JsonToken.VALUE_FALSE
returns matching Boolean value; otherwise return null. |
boolean |
nextFieldName(SerializableString str)
Method that fetches next token (as if calling
JacksonParser.nextToken()) and
verifies whether it is JsonToken.FIELD_NAME with specified name
and returns result of that comparison. |
int |
nextIntValue(int defaultValue)
Method that fetches next token (as if calling
JacksonParser.nextToken()) and
if it is JsonToken.VALUE_NUMBER_INT returns 32-bit int value;
otherwise returns specified default value
It is functionally equivalent to:
return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? |
long |
nextLongValue(long defaultValue)
Method that fetches next token (as if calling
JacksonParser.nextToken()) and
if it is JsonToken.VALUE_NUMBER_INT returns 64-bit long value;
otherwise returns specified default value
It is functionally equivalent to:
return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? |
String |
nextTextValue()
Method that fetches next token (as if calling
JacksonParser.nextToken()) and
if it is JsonToken.VALUE_STRING returns contained String value;
otherwise returns null. |
JsonToken |
nextToken()
Main iteration method, which will advance stream enough
to determine type of the next token, if any.
|
int |
releaseBuffered(OutputStream out)
Method that can be called to push back any content that
has been read but not consumed by the parser.
|
void |
setCodec(ObjectCodec c)
Setter that allows defining
ObjectCodec associated with this
parser, if any. |
Version |
version()
Accessor for getting version of the core package, given a parser instance.
|
_getByteArrayBuilder, getBigIntegerValue, getCurrentLocation, getCurrentName, getDecimalValue, getDoubleValue, getFloatValue, getIntValue, getLongValue, getNumberType, getNumberValue, getParsingContext, getTokenCharacterOffset, getTokenColumnNr, getTokenLineNr, getTokenLocation, hasTextCharacters, isClosed, overrideCurrentNameclearCurrentToken, getCurrentToken, getLastClearedToken, getValueAsBoolean, getValueAsDouble, getValueAsInt, getValueAsLong, hasCurrentToken, nextValue, skipChildrencanUseSchema, configure, disable, enable, getBinaryValue, getBooleanValue, getByteValue, getSchema, getShortValue, getValueAsBoolean, getValueAsDouble, getValueAsInt, getValueAsLong, isEnabled, isExpectedStartArrayToken, readValueAs, readValueAs, readValueAsTree, readValuesAs, readValuesAs, releaseBuffered, setSchemapublic UTF8StreamJsonParser(IOContext ctxt, int features, InputStream in, ObjectCodec codec, BytesToNameCanonicalizer sym, byte[] inputBuffer, int start, int end, boolean bufferRecyclable)
public static int[] growArrayBy(int[] arr,
int more)
public ObjectCodec getCodec()
JacksonParserObjectCodec associated with this
parser, if any. Codec is used by JacksonParser.readValueAs(Class)
method (and its variants).getCodec 在类中 JacksonParserpublic void setCodec(ObjectCodec c)
JacksonParserObjectCodec associated with this
parser, if any. Codec is used by JacksonParser.readValueAs(Class)
method (and its variants).setCodec 在类中 JacksonParserpublic Version version()
JacksonParserversion 在接口中 Versionedversion 在类中 ParserMinimalBasepublic int releaseBuffered(OutputStream out) throws IOException
JacksonParserreleaseBuffered 在类中 JacksonParserOutputStream;
otherwise number of bytes released (0 if there was nothing to release)IOException - if write to stream threw exceptionpublic Object getInputSource()
JacksonParserInputStream or Reader, depending on what
parser was constructed with.
Note that returned value may be null in some cases; including
case where parser implementation does not want to exposed raw
source to caller.
In cases where input has been decorated, object returned here
is the decorated version; this allows some level of interaction
between users of parser and decorator object.
In general use of this accessor should be considered as "last effort", i.e. only used if no other mechanism is applicable.
getInputSource 在类中 JacksonParserpublic String getText() throws IOException, JsonParseException
JacksonParserJacksonParser.nextToken(), or
after encountering end-of-input), returns null.
Method can be called for any token type.getText 在类中 ParserMinimalBaseIOExceptionJsonParseExceptionpublic char[] getTextCharacters()
throws IOException,
JsonParseException
JacksonParserJacksonParser.getText(), but that will return
underlying (unmodifiable) character array that contains
textual value, instead of constructing a String object
to contain this information.
Note, however, that:
JacksonParser.getTextOffset()) to
know the actual offset
JacksonParser.getTextLength()
for actual length of returned content.
Note that caller MUST NOT modify the returned character array in any way -- doing so may corrupt current parser state and render parser instance useless.
The only reason to call this method (over JacksonParser.getText())
is to avoid construction of a String object (which
will make a copy of contents).
getTextCharacters 在类中 ParserMinimalBaseIOExceptionJsonParseExceptionpublic int getTextLength()
throws IOException,
JsonParseException
JacksonParserJacksonParser.getTextCharacters(), to know length
of String stored in returned buffer.getTextLength 在类中 ParserMinimalBaseJacksonParser.getTextCharacters() that are part of
textual content of the current token.IOExceptionJsonParseExceptionpublic int getTextOffset()
throws IOException,
JsonParseException
JacksonParserJacksonParser.getTextCharacters(), to know offset
of the first text content character within buffer.getTextOffset 在类中 ParserMinimalBaseJacksonParser.getTextCharacters() that is part of
textual content of the current token.IOExceptionJsonParseExceptionpublic Object getEmbeddedObject() throws IOException, JsonParseException
JacksonParserJsonToken.VALUE_EMBEDDED_OBJECT. For other token types,
null is returned.
Note: only some specialized parser implementations support embedding of objects (usually ones that are facades on top of non-streaming sources, such as object trees).
getEmbeddedObject 在类中 JacksonParserIOExceptionJsonParseExceptionpublic byte[] getBinaryValue(Base64Variant b64variant) throws IOException, JsonParseException
JacksonParserJacksonParser.getText()
and decoding result (except for decoding part),
but should be significantly more performant.
Note that non-decoded textual contents of the current token are not guaranteed to be accessible after this method is called. Current implementation, for example, clears up textual content during decoding. Decoded binary content, however, will be retained until parser is advanced to the next event.
getBinaryValue 在类中 ParserMinimalBaseb64variant - Expected variant of base64 encoded
content (see Base64Variants for definitions
of "standard" variants).IOExceptionJsonParseExceptionpublic JsonToken nextToken() throws IOException, JsonParseException
JacksonParsernextToken 在类中 ParserMinimalBaseIOExceptionJsonParseExceptionpublic void close()
throws IOException
JacksonParserJacksonParser.Feature.AUTO_CLOSE_SOURCE is enabled.
Whether parser owns the input source depends on factory
method that was used to construct instance (so check
JsonFactory for details,
but the general
idea is that if caller passes in closable resource (such
as InputStream or Reader) parser does NOT
own the source; but if it passes a reference (such as
File or URL and creates
stream or reader it does own them.close 在接口中 Closeableclose 在接口中 AutoCloseableclose 在类中 ParserBaseIOExceptionpublic boolean nextFieldName(SerializableString str) throws IOException, JsonParseException
JacksonParserJacksonParser.nextToken()) and
verifies whether it is JsonToken.FIELD_NAME with specified name
and returns result of that comparison.
It is functionally equivalent to:
return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(getCurrentName());but may be faster for parser to verify, and can therefore be used if caller expects to get such a property name from input next.
nextFieldName 在类中 JacksonParserstr - Property name to compare next token to (if next token is JsonToken.FIELD_NAME)IOExceptionJsonParseExceptionpublic String nextTextValue() throws IOException, JsonParseException
JacksonParserJacksonParser.nextToken()) and
if it is JsonToken.VALUE_STRING returns contained String value;
otherwise returns null.
It is functionally equivalent to:
return (nextToken() == JsonToken.VALUE_STRING) ? getText() : null;but may be faster for parser to process, and can therefore be used if caller expects to get a String value next from input.
nextTextValue 在类中 JacksonParserIOExceptionJsonParseExceptionpublic int nextIntValue(int defaultValue)
throws IOException,
JsonParseException
JacksonParserJacksonParser.nextToken()) and
if it is JsonToken.VALUE_NUMBER_INT returns 32-bit int value;
otherwise returns specified default value
It is functionally equivalent to:
return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? getIntValue() : defaultValue;but may be faster for parser to process, and can therefore be used if caller expects to get a String value next from input.
nextIntValue 在类中 JacksonParserIOExceptionJsonParseExceptionpublic long nextLongValue(long defaultValue)
throws IOException,
JsonParseException
JacksonParserJacksonParser.nextToken()) and
if it is JsonToken.VALUE_NUMBER_INT returns 64-bit long value;
otherwise returns specified default value
It is functionally equivalent to:
return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? getLongValue() : defaultValue;but may be faster for parser to process, and can therefore be used if caller expects to get a String value next from input.
nextLongValue 在类中 JacksonParserIOExceptionJsonParseExceptionpublic Boolean nextBooleanValue() throws IOException, JsonParseException
JacksonParserJacksonParser.nextToken()) and
if it is JsonToken.VALUE_TRUE or JsonToken.VALUE_FALSE
returns matching Boolean value; otherwise return null.
It is functionally equivalent to:
JsonToken t = nextToken(); if (t == JsonToken.VALUE_TRUE) return Boolean.TRUE; if (t == JsonToken.VALUE_FALSE) return Boolean.FALSE; return null;but may be faster for parser to process, and can therefore be used if caller expects to get a String value next from input.
nextBooleanValue 在类中 JacksonParserIOExceptionJsonParseExceptionCopyright © 2002–2019 The MyMMSCs Software Foundation. All rights reserved.