org.codehaus.jackson.impl
Class Utf8NumericParser

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.StreamBasedParserBase
                      extended by org.codehaus.jackson.impl.Utf8NumericParser
All Implemented Interfaces:
Closeable, Versioned
Direct Known Subclasses:
Utf8StreamParser

public abstract class Utf8NumericParser
extends StreamBasedParserBase

Intermediate class that implements handling of numeric parsing, when using UTF-8 encoded byte-based input source. 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.StreamBasedParserBase
_bufferRecyclable, _inputBuffer, _inputStream
 
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
Utf8NumericParser(IOContext pc, int features, InputStream in, byte[] inputBuffer, int start, int end, boolean bufferRecyclable)
           
 
Method Summary
protected  JsonToken parseNumberText(int c)
          Initial parsing method for number values.
 
Methods inherited from class org.codehaus.jackson.impl.StreamBasedParserBase
_closeInput, _loadToHaveAtLeast, _releaseBuffers, 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

Utf8NumericParser

public Utf8NumericParser(IOContext pc,
                         int features,
                         InputStream in,
                         byte[] inputBuffer,
                         int start,
                         int end,
                         boolean bufferRecyclable)
Method Detail

parseNumberText

protected final JsonToken parseNumberText(int c)
                                   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