org.codehaus.jackson.impl
Class StreamBasedParserBase

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
All Implemented Interfaces:
Closeable
Direct Known Subclasses:
Utf8NumericParser

public abstract class StreamBasedParserBase
extends JsonNumericParserBase

This is a simple low-level input reader base class, used by JSON parser. It is used when underlying input source is a byte stream such as InputStream. The reason for sub-classing (over composition) is due to need for direct access to low-level byte buffers and positions.

Author:
Tatu Saloranta

Nested Class Summary
 
Nested classes/interfaces inherited from class org.codehaus.jackson.JsonParser
JsonParser.Feature, JsonParser.NumberType
 
Field Summary
protected  boolean _bufferRecyclable
          Flag that indicates whether the input buffer is recycable (and needs to be returned to recycler once we are done) or not.
protected  byte[] _inputBuffer
          Current buffer from which data is read; generally data is read into buffer from input source, but in some cases pre-loaded buffer is handed to the parser.
protected  InputStream _inputStream
          Input stream that can be used for reading more content, if one in use.
 
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
protected StreamBasedParserBase(IOContext ctxt, int features, InputStream in, byte[] inputBuffer, int start, int end, boolean bufferRecyclable)
           
 
Method Summary
protected  void _closeInput()
           
protected  void _releaseBuffers()
          Method called to release internal buffers owned by the base reader.
protected  boolean loadMore()
           
 
Methods inherited from class org.codehaus.jackson.impl.JsonNumericParserBase
convertNumberToBigDecimal, convertNumberToBigInteger, convertNumberToDouble, convertNumberToInt, convertNumberToLong, getBigIntegerValue, getDecimalValue, getDoubleValue, getFloatValue, getIntValue, getLongValue, getNumberType, getNumberValue, parseNumberText, 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
 

Field Detail

_inputStream

protected InputStream _inputStream
Input stream that can be used for reading more content, if one in use. May be null, if input comes just as a full buffer, or if the stream has been closed.


_inputBuffer

protected byte[] _inputBuffer
Current buffer from which data is read; generally data is read into buffer from input source, but in some cases pre-loaded buffer is handed to the parser.


_bufferRecyclable

protected boolean _bufferRecyclable
Flag that indicates whether the input buffer is recycable (and needs to be returned to recycler once we are done) or not.

Constructor Detail

StreamBasedParserBase

protected StreamBasedParserBase(IOContext ctxt,
                                int features,
                                InputStream in,
                                byte[] inputBuffer,
                                int start,
                                int end,
                                boolean bufferRecyclable)
Method Detail

loadMore

protected final boolean loadMore()
                          throws IOException
Specified by:
loadMore in class JsonParserBase
Throws:
IOException

_closeInput

protected void _closeInput()
                    throws IOException
Specified by:
_closeInput in class JsonParserBase
Throws:
IOException

_releaseBuffers

protected void _releaseBuffers()
                        throws IOException
Method called to release internal buffers owned by the base reader. This may be called along with _closeInput() (for example, when explicitly closing this reader instance), or separately (if need be).

Overrides:
_releaseBuffers in class JsonParserBase
Throws:
IOException