org.codehaus.jackson.impl
Class Utf8NumericParser

java.lang.Object
  extended by org.codehaus.jackson.JsonParser
      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
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, _closed, _currInputProcessed, _currInputRow, _currInputRowStart, _inputEnd, _inputPtr, _ioContext, _nameCopied, _nameCopyBuffer, _nextToken, _parsingContext, _textBuffer, _tokenIncomplete, _tokenInputCol, _tokenInputRow, _tokenInputTotal
 
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, _releaseBuffers, loadMore
 
Methods inherited from class org.codehaus.jackson.impl.JsonNumericParserBase
convertNumberToBigDecimal, convertNumberToBigInteger, convertNumberToDouble, convertNumberToInt, convertNumberToLong, getBigIntegerValue, getDecimalValue, getDoubleValue, getFloatValue, getIntValue, getLongValue, getNumberType, getNumberValue, parseNumericValue, reportInvalidNumber, reportOverflowInt, reportOverflowLong, reportUnexpectedNumberChar, reset
 
Methods inherited from class org.codehaus.jackson.impl.JsonParserBase
_constructError, _decodeBase64, _finishString, _getByteArrayBuilder, _getCharDesc, _handleEOF, _reportError, _reportInvalidEOF, _reportInvalidEOF, _reportMismatchedEndMarker, _reportUnexpectedChar, _throwInternal, _throwInvalidSpace, _throwUnquotedSpace, _wrapError, close, getBinaryValue, getCurrentLocation, getCurrentName, getParsingContext, getText, getTextCharacters, getTextLength, getTextOffset, getTokenCharacterOffset, getTokenColumnNr, getTokenLineNr, getTokenLocation, isClosed, loadMoreGuaranteed, 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, hasCurrentToken, isEnabled, isFeatureEnabled, nextValue, readValueAs, readValueAs, readValueAsTree, 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.

Specified by:
parseNumberText in class JsonNumericParserBase
Throws:
IOException
JsonParseException