|
JSON Version 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.jackson.JsonParser
org.codehaus.jackson.impl.ReaderBasedParserBase
org.codehaus.jackson.impl.ReaderBasedNumericParser
org.codehaus.jackson.impl.ReaderBasedParser
public final class ReaderBasedParser
This is a concrete implementation of JsonParser
, which is
based on a Reader
to handle low-level character
conversion tasks.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.codehaus.jackson.JsonParser |
---|
JsonParser.NumberType |
Field Summary | |
---|---|
protected boolean |
mExpectSeparator
Flag set when a separator or closing marker for the context is expected. |
protected boolean |
mFieldInBuffer
Flag set to indicate whether field name parsed is available from the text buffer or not. |
protected JsonReadContext |
mParsingContext
|
protected SymbolTable |
mSymbols
|
protected boolean |
mTokenIncomplete
Flag that indicates that the current token has not yet been fully processed, and needs to be finished for some access (or skipped to obtain the next token) |
Fields inherited from class org.codehaus.jackson.impl.ReaderBasedNumericParser |
---|
CHAR_NULL, INT_0, INT_1, INT_2, INT_3, INT_4, INT_5, INT_6, INT_7, INT_8, INT_9, INT_DECIMAL_POINT, INT_e, INT_E, INT_MINUS, INT_PLUS, mExpLength, mFractLength, mIntLength, mNumberBigDecimal, mNumberBigInt, mNumberDouble, mNumberInt, mNumberLong, mNumberNegative, mNumTypesValid, NR_BIGDECIMAL, NR_BIGINT, NR_DOUBLE, NR_INT, NR_LONG |
Fields inherited from class org.codehaus.jackson.impl.ReaderBasedParserBase |
---|
mCurrInputProcessed, mCurrInputRow, mCurrInputRowStart, mCurrToken, mInputBuffer, mInputLen, mInputPtr, mIOContext, mReader, mTextBuffer, mTokenInputCol, mTokenInputRow, mTokenInputTotal |
Constructor Summary | |
---|---|
ReaderBasedParser(IOContext ioCtxt,
Reader r,
SymbolTable st)
|
Method Summary | |
---|---|
void |
close()
|
protected char |
decodeEscaped()
|
protected void |
finishString()
|
protected void |
finishToken()
Method called to finish parsing of a partially parsed token, in order to access information regarding it. |
JsonLocation |
getCurrentLocation()
Method that returns location of the last processed character; usually for error reporting purposes |
String |
getCurrentName()
Method that can be called to get the name associated with the current event. |
JsonToken |
getCurrentToken()
|
BigDecimal |
getDecimalValue()
|
double |
getDoubleValue()
|
int |
getIntValue()
Numeric accessor that can be called when the current token is of type JsonToken.VALUE_NUMBER_INT and
it can be expressed as a Java int primitive type. |
long |
getLongValue()
Numeric accessor that can be called when the current token is of type JsonToken.VALUE_NUMBER_INT and
it can be expressed as a Java long primitive type. |
JsonParser.NumberType |
getNumberType()
If current event is of type JsonToken.VALUE_NUMBER_INT or
JsonToken.VALUE_NUMBER_FLOAT , returns
one of type constants; otherwise returns null. |
Number |
getNumberValue()
Generic number value accessor method that will work for all kinds of numeric values. |
JsonReadContext |
getParsingContext()
Method that can be used to access current parsing context reader is in. |
String |
getText()
Method for accessing textual representation of the current event; if no current event (before first call to nextToken() , or
after encountering end-of-input), returns null. |
char[] |
getTextCharacters()
|
int |
getTextLength()
|
int |
getTextOffset()
|
JsonLocation |
getTokenLocation()
Method that return the starting location of the current token; that is, position of the first character from input that starts the current token. |
protected void |
handleEOF()
Method called when an EOF is encountered between tokens. |
protected JsonToken |
handleFieldName(int i)
|
boolean |
hasCurrentToken()
|
protected JsonToken |
matchToken(JsonToken token)
|
JsonToken |
nextToken()
|
protected void |
reportMismatchedEndMarker(int actCh,
char expCh)
|
protected void |
skipPartial()
Method called to process and skip remaining contents of a partially read token. |
protected void |
skipString()
Method called to skim through rest of unparsed String value, if it is not needed. |
protected JsonToken |
startString()
|
protected void |
throwInvalidSpace(int i)
|
protected void |
throwUnquotedSpace(int i,
String ctxtDesc)
|
Methods inherited from class org.codehaus.jackson.impl.ReaderBasedNumericParser |
---|
convertNumberToBigDecimal, convertNumberToDouble, convertNumberToInt, convertNumberToLong, parseNumberText, parseNumericValue, reportInvalidNumber, reportOverflowInt, reportOverflowLong, reportUnexpectedNumberChar |
Methods inherited from class org.codehaus.jackson.impl.ReaderBasedParserBase |
---|
closeReader, getCharDesc, getNextChar, getTokenCharacterOffset, getTokenColumnNr, getTokenLineNr, loadMore, markLF, markLF, releaseBuffers, reportError, reportInvalidEOF, reportUnexpectedChar, skipCR, skipLF, throwInternal, wrapError |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final SymbolTable mSymbols
protected JsonReadContext mParsingContext
protected boolean mTokenIncomplete
protected boolean mExpectSeparator
protected boolean mFieldInBuffer
Constructor Detail |
---|
public ReaderBasedParser(IOContext ioCtxt, Reader r, SymbolTable st)
Method Detail |
---|
public JsonToken nextToken() throws IOException, JsonParseException
nextToken
in class JsonParser
IOException
JsonParseException
public JsonToken getCurrentToken()
getCurrentToken
in class JsonParser
public boolean hasCurrentToken()
hasCurrentToken
in class JsonParser
public String getCurrentName() throws IOException, JsonParseException
JsonToken.FIELD_NAME
.
getCurrentName
in class JsonParser
IOException
JsonParseException
public void close() throws IOException
close
in class JsonParser
IOException
public JsonReadContext getParsingContext()
getParsingContext
in class JsonParser
public JsonLocation getTokenLocation()
getTokenLocation
in class JsonParser
public JsonLocation getCurrentLocation()
getCurrentLocation
in class ReaderBasedParserBase
public String getText() throws IOException, JsonParseException
nextToken()
, or
after encountering end-of-input), returns null.
Method can be called for any event.
getText
in class ReaderBasedNumericParser
IOException
JsonParseException
public char[] getTextCharacters() throws IOException, JsonParseException
getTextCharacters
in class JsonParser
IOException
JsonParseException
public int getTextLength() throws IOException, JsonParseException
getTextLength
in class JsonParser
IOException
JsonParseException
public int getTextOffset() throws IOException, JsonParseException
getTextOffset
in class JsonParser
IOException
JsonParseException
public Number getNumberValue() throws IOException, JsonParseException
JsonParser
getNumberValue
in class JsonParser
IOException
JsonParseException
public JsonParser.NumberType getNumberType() throws IOException, JsonParseException
JsonParser
JsonToken.VALUE_NUMBER_INT
or
JsonToken.VALUE_NUMBER_FLOAT
, returns
one of type constants; otherwise returns null.
getNumberType
in class JsonParser
IOException
JsonParseException
public int getIntValue() throws IOException, JsonParseException
JsonParser
JsonToken.VALUE_NUMBER_INT
and
it can be expressed as a Java int primitive type.
Note: if the token is an integer, but its value falls
outside of range of Java int, a JsonParseException
will be thrown to indicate numeric overflow/underflow.
getIntValue
in class JsonParser
IOException
JsonParseException
public long getLongValue() throws IOException, JsonParseException
JsonParser
JsonToken.VALUE_NUMBER_INT
and
it can be expressed as a Java long primitive type.
Note: if the token is an integer, but its value falls
outside of range of Java long, a JsonParseException
will be thrown to indicate numeric overflow/underflow.
getLongValue
in class JsonParser
IOException
JsonParseException
public double getDoubleValue() throws IOException, JsonParseException
getDoubleValue
in class JsonParser
IOException
JsonParseException
public BigDecimal getDecimalValue() throws IOException, JsonParseException
getDecimalValue
in class JsonParser
IOException
JsonParseException
protected JsonToken handleFieldName(int i) throws IOException, JsonParseException
IOException
JsonParseException
protected JsonToken startString() throws IOException, JsonParseException
IOException
JsonParseException
protected void finishString() throws IOException, JsonParseException
IOException
JsonParseException
protected void skipString() throws IOException, JsonParseException
IOException
JsonParseException
protected JsonToken matchToken(JsonToken token) throws IOException, JsonParseException
IOException
JsonParseException
protected final void skipPartial() throws IOException, JsonParseException
IOException
JsonParseException
protected final void finishToken() throws IOException, JsonParseException
IOException
JsonParseException
protected final char decodeEscaped() throws IOException, JsonParseException
IOException
JsonParseException
protected void handleEOF() throws JsonParseException
JsonParseException
protected void throwInvalidSpace(int i) throws JsonParseException
JsonParseException
protected void throwUnquotedSpace(int i, String ctxtDesc) throws JsonParseException
JsonParseException
protected void reportMismatchedEndMarker(int actCh, char expCh) throws JsonParseException
JsonParseException
|
JSON Version 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |