org.codehaus.jackson.impl
Class ReaderBasedNumericParser

java.lang.Object
  extended by org.codehaus.jackson.JsonParser
      extended by org.codehaus.jackson.impl.JsonParserMinimalBase
          extended by org.codehaus.jackson.impl.JsonParserBase
              extended by org.codehaus.jackson.impl.JsonNumericParserBase
                  extended by org.codehaus.jackson.impl.ReaderBasedParserBase
                      extended by org.codehaus.jackson.impl.ReaderBasedNumericParser
All Implemented Interfaces:
Closeable, Versioned
Direct Known Subclasses:
ReaderBasedParser

public abstract class ReaderBasedNumericParser
extends ReaderBasedParserBase

Intermediate class that implements handling of numeric parsing. Separate from the actual parser class just to isolate numeric parsing: would be nice to use aggregation, but unfortunately many parts are hard to implement without direct access to underlying buffers.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.codehaus.jackson.JsonParser
JsonParser.Feature, JsonParser.NumberType
 
Field Summary
 
Fields inherited from class org.codehaus.jackson.impl.ReaderBasedParserBase
_inputBuffer, _reader
 
Fields inherited from class org.codehaus.jackson.impl.JsonNumericParserBase
_numberBigDecimal, _numberBigInt, _numberDouble, _numberInt, _numberLong, _numberNegative, _numTypesValid, 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, NR_BIGDECIMAL, NR_BIGINT, NR_DOUBLE, NR_INT, NR_LONG, NR_UNKNOWN
 
Fields inherited from class org.codehaus.jackson.impl.JsonParserBase
_binaryValue, _byteArrayBuilder, _closed, _currInputProcessed, _currInputRow, _currInputRowStart, _inputEnd, _inputPtr, _ioContext, _nameCopied, _nameCopyBuffer, _nextToken, _parsingContext, _textBuffer, _tokenIncomplete, _tokenInputCol, _tokenInputRow, _tokenInputTotal
 
Fields inherited from class org.codehaus.jackson.impl.JsonParserMinimalBase
INT_APOSTROPHE, INT_ASTERISK, INT_b, INT_BACKSLASH, INT_COLON, INT_COMMA, INT_CR, INT_f, INT_LBRACKET, INT_LCURLY, INT_LF, INT_n, INT_QUOTE, INT_r, INT_RBRACKET, INT_RCURLY, INT_SLASH, INT_SPACE, INT_t, INT_TAB, INT_u
 
Fields inherited from class org.codehaus.jackson.JsonParser
_currToken, _features, _lastClearedToken
 
Constructor Summary
ReaderBasedNumericParser(IOContext pc, int features, Reader r)
           
 
Method Summary
protected  JsonToken parseNumberText(int ch)
          Initial parsing method for number values.
 
Methods inherited from class org.codehaus.jackson.impl.ReaderBasedParserBase
_closeInput, _releaseBuffers, getNextChar, loadMore, releaseBuffered
 
Methods inherited from class org.codehaus.jackson.impl.JsonNumericParserBase
_parseNumericValue, convertNumberToBigDecimal, convertNumberToBigInteger, convertNumberToDouble, convertNumberToInt, convertNumberToLong, getBigIntegerValue, getDecimalValue, getDoubleValue, getFloatValue, getIntValue, getLongValue, getNumberType, getNumberValue, reportInvalidNumber, reportOverflowInt, reportOverflowLong, reportUnexpectedNumberChar, reset
 
Methods inherited from class org.codehaus.jackson.impl.JsonParserBase
_decodeBase64, _finishString, _getByteArrayBuilder, _handleEOF, _reportMismatchedEndMarker, close, getBinaryValue, getCurrentLocation, getCurrentName, getParsingContext, getText, getTextCharacters, getTextLength, getTextOffset, getTokenCharacterOffset, getTokenColumnNr, getTokenLineNr, getTokenLocation, hasTextCharacters, isClosed, loadMoreGuaranteed, version
 
Methods inherited from class org.codehaus.jackson.impl.JsonParserMinimalBase
_constructError, _getCharDesc, _handleUnrecognizedCharacterEscape, _reportError, _reportInvalidEOF, _reportInvalidEOF, _reportUnexpectedChar, _throwInternal, _throwInvalidSpace, _throwUnquotedSpace, _wrapError, getValueAsDouble, getValueAsInt, getValueAsLong, nextToken, skipChildren
 
Methods inherited from class org.codehaus.jackson.JsonParser
_constructError, clearCurrentToken, configure, disable, disableFeature, enable, enableFeature, getBinaryValue, getBooleanValue, getByteValue, getCodec, getCurrentToken, getEmbeddedObject, getLastClearedToken, getShortValue, getValueAsDouble, getValueAsInt, getValueAsLong, hasCurrentToken, isEnabled, isFeatureEnabled, nextValue, readValueAs, readValueAs, readValueAsTree, releaseBuffered, setCodec, setFeature
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReaderBasedNumericParser

public ReaderBasedNumericParser(IOContext pc,
                                int features,
                                Reader r)
Method Detail

parseNumberText

protected final JsonToken parseNumberText(int ch)
                                   throws IOException,
                                          JsonParseException
Initial parsing method for number values. It needs to be able to parse enough input to be able to determine whether the value is to be considered a simple integer value, or a more generic decimal value: latter of which needs to be expressed as a floating point number. The basic rule is that if the number has no fractional or exponential part, it is an integer; otherwise a floating point number.

Because much of input has to be processed in any case, no partial parsing is done: all input text will be stored for further processing. However, actual numeric value conversion will be deferred, since it is usually the most complicated and costliest part of processing.

Throws:
IOException
JsonParseException