com.bazaarvoice.jackson.rison
Class RisonParser

java.lang.Object
  extended by com.fasterxml.jackson.core.JsonParser
      extended by com.fasterxml.jackson.core.base.ParserMinimalBase
          extended by com.fasterxml.jackson.core.base.ParserBase
              extended by com.bazaarvoice.jackson.rison.RisonParser
All Implemented Interfaces:
com.fasterxml.jackson.core.Versioned, Closeable

public class RisonParser
extends com.fasterxml.jackson.core.base.ParserBase

This is a concrete implementation of JsonParser, which is based on a Reader to handle low-level character conversion tasks.


Nested Class Summary
static class RisonParser.Feature
          Enumeration that defines all configurable features for Rison parsers.
 
Nested classes/interfaces inherited from class com.fasterxml.jackson.core.JsonParser
com.fasterxml.jackson.core.JsonParser.NumberType
 
Field Summary
protected  char[] _inputBuffer
          Current buffer from which data is read; generally data is read into buffer from input source.
protected  com.fasterxml.jackson.core.ObjectCodec _objectCodec
           
protected  Reader _reader
          Reader that can be used for reading more content, if one buffer from input source, but in some cases pre-loaded buffer is handed to the parser.
protected  int _risonFeatures
           
protected  com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer _symbols
           
protected  boolean _tokenIncomplete
          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 com.fasterxml.jackson.core.base.ParserBase
_binaryValue, _byteArrayBuilder, _closed, _currInputProcessed, _currInputRow, _currInputRowStart, _expLength, _fractLength, _inputEnd, _inputPtr, _intLength, _ioContext, _nameCopied, _nameCopyBuffer, _nextToken, _numberBigDecimal, _numberBigInt, _numberDouble, _numberInt, _numberLong, _numberNegative, _numTypesValid, _parsingContext, _textBuffer, _tokenInputCol, _tokenInputRow, _tokenInputTotal, 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, NR_BIGDECIMAL, NR_BIGINT, NR_DOUBLE, NR_INT, NR_LONG, NR_UNKNOWN
 
Fields inherited from class com.fasterxml.jackson.core.base.ParserMinimalBase
_currToken, _lastClearedToken, 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 com.fasterxml.jackson.core.JsonParser
_features
 
Constructor Summary
RisonParser(com.fasterxml.jackson.core.io.IOContext ctxt, int jsonFeatures, int risonFeatures, Reader r, com.fasterxml.jackson.core.ObjectCodec codec, com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer st)
           
 
Method Summary
protected  void _closeInput()
           
protected  byte[] _decodeBase64(com.fasterxml.jackson.core.Base64Variant b64variant)
          Efficient handling for incremental parsing of base64-encoded textual content.
protected  int _decodeBase64Escape2(com.fasterxml.jackson.core.Base64Variant b64variant, char ch, int index)
           
protected  char _decodeEscaped()
           
protected  void _finishString()
           
protected  void _finishString2()
           
protected  String _getText2(com.fasterxml.jackson.core.JsonToken t)
           
protected  com.fasterxml.jackson.core.JsonToken _handleInvalidNumberStart(int ch, boolean negative)
          Method called if expected numeric value (due to leading sign) does not look like a number
protected  com.fasterxml.jackson.core.JsonToken _handleUnexpectedValue(int i)
          Method for handling cases where first non-space character of an expected value token is not legal for standard JSON content.
protected  void _matchToken(String matchStr, int i)
          Helper method for checking whether input matches expected token
protected  String _parseFieldName(int i)
           
protected  String _parseUnquotedFieldName(int i)
          Method called when we see non-white space character other than double quote, when expecting a field name.
protected  void _parseUnquotedString()
           
protected  void _parseUnquotedString2()
           
protected  void _releaseBuffers()
          Method called to release internal buffers owned by the base reader.
protected  void _reportInvalidToken(String matchedPart, String msg)
           
protected  void _skipString()
          Method called to skim through rest of unparsed String value, if it is not needed.
 void close()
           
 byte[] getBinaryValue(com.fasterxml.jackson.core.Base64Variant b64variant)
           
 com.fasterxml.jackson.core.ObjectCodec getCodec()
           
 Object getEmbeddedObject()
           
 Object getInputSource()
           
protected  char getNextChar(String eofMsg)
           
 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()
           
protected  boolean loadMore()
           
 Boolean nextBooleanValue()
           
 int nextIntValue(int defaultValue)
           
 long nextLongValue(long defaultValue)
           
 String nextTextValue()
           
 com.fasterxml.jackson.core.JsonToken nextToken()
           
protected  com.fasterxml.jackson.core.JsonToken parseNumberText(int ch)
          Initial parsing method for number values.
 int releaseBuffered(Writer w)
           
 void setCodec(com.fasterxml.jackson.core.ObjectCodec c)
           
 com.fasterxml.jackson.core.Version version()
           
 
Methods inherited from class com.fasterxml.jackson.core.base.ParserBase
_decodeBase64Escape, _decodeBase64Escape, _getByteArrayBuilder, _handleEOF, _parseNumericValue, _reportMismatchedEndMarker, convertNumberToBigDecimal, convertNumberToBigInteger, convertNumberToDouble, convertNumberToInt, convertNumberToLong, getBigIntegerValue, getCurrentLocation, getCurrentName, getDecimalValue, getDoubleValue, getFloatValue, getIntValue, getLongValue, getNumberType, getNumberValue, getParsingContext, getTokenCharacterOffset, getTokenColumnNr, getTokenLineNr, getTokenLocation, hasTextCharacters, isClosed, loadMoreGuaranteed, overrideCurrentName, reportInvalidBase64Char, reportInvalidBase64Char, reportInvalidNumber, reportOverflowInt, reportOverflowLong, reportUnexpectedNumberChar, reset, resetAsNaN, resetFloat, resetInt
 
Methods inherited from class com.fasterxml.jackson.core.base.ParserMinimalBase
_constructError, _decodeBase64, _getCharDesc, _handleUnrecognizedCharacterEscape, _reportBase64EOF, _reportError, _reportInvalidBase64, _reportInvalidEOF, _reportInvalidEOF, _reportInvalidEOFInValue, _reportUnexpectedChar, _throwInternal, _throwInvalidSpace, _throwUnquotedSpace, _wrapError, clearCurrentToken, getCurrentToken, getLastClearedToken, getValueAsBoolean, getValueAsDouble, getValueAsInt, getValueAsLong, getValueAsString, hasCurrentToken, nextValue, skipChildren
 
Methods inherited from class com.fasterxml.jackson.core.JsonParser
_constructError, _reportUnsupportedOperation, canUseSchema, configure, disable, enable, getBinaryValue, getBooleanValue, getByteValue, getSchema, getShortValue, getValueAsBoolean, getValueAsDouble, getValueAsInt, getValueAsLong, getValueAsString, isEnabled, isExpectedStartArrayToken, nextFieldName, readBinaryValue, readBinaryValue, readValueAs, readValueAs, readValueAsTree, readValuesAs, readValuesAs, releaseBuffered, requiresCustomCodec, setSchema
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_reader

protected Reader _reader
Reader that can be used for reading more content, if one buffer from input source, but in some cases pre-loaded buffer is handed to the parser.


_inputBuffer

protected char[] _inputBuffer
Current buffer from which data is read; generally data is read into buffer from input source.


_objectCodec

protected com.fasterxml.jackson.core.ObjectCodec _objectCodec

_symbols

protected final com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer _symbols

_risonFeatures

protected final int _risonFeatures

_tokenIncomplete

protected boolean _tokenIncomplete
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)

Constructor Detail

RisonParser

public RisonParser(com.fasterxml.jackson.core.io.IOContext ctxt,
                   int jsonFeatures,
                   int risonFeatures,
                   Reader r,
                   com.fasterxml.jackson.core.ObjectCodec codec,
                   com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer st)
Method Detail

version

public com.fasterxml.jackson.core.Version version()
Specified by:
version in interface com.fasterxml.jackson.core.Versioned
Overrides:
version in class com.fasterxml.jackson.core.base.ParserMinimalBase

getCodec

public com.fasterxml.jackson.core.ObjectCodec getCodec()
Specified by:
getCodec in class com.fasterxml.jackson.core.JsonParser

setCodec

public void setCodec(com.fasterxml.jackson.core.ObjectCodec c)
Specified by:
setCodec in class com.fasterxml.jackson.core.JsonParser

releaseBuffered

public int releaseBuffered(Writer w)
                    throws IOException
Overrides:
releaseBuffered in class com.fasterxml.jackson.core.JsonParser
Throws:
IOException

getInputSource

public Object getInputSource()
Overrides:
getInputSource in class com.fasterxml.jackson.core.JsonParser

loadMore

protected boolean loadMore()
                    throws IOException
Specified by:
loadMore in class com.fasterxml.jackson.core.base.ParserBase
Throws:
IOException

getNextChar

protected char getNextChar(String eofMsg)
                    throws IOException,
                           com.fasterxml.jackson.core.JsonParseException
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

_closeInput

protected void _closeInput()
                    throws IOException
Specified by:
_closeInput in class com.fasterxml.jackson.core.base.ParserBase
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 com.fasterxml.jackson.core.base.ParserBase
Throws:
IOException

getText

public String getText()
               throws IOException,
                      com.fasterxml.jackson.core.JsonParseException
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. Method can be called for any event.

Specified by:
getText in class com.fasterxml.jackson.core.base.ParserMinimalBase
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

_getText2

protected String _getText2(com.fasterxml.jackson.core.JsonToken t)

getTextCharacters

public char[] getTextCharacters()
                         throws IOException,
                                com.fasterxml.jackson.core.JsonParseException
Specified by:
getTextCharacters in class com.fasterxml.jackson.core.base.ParserMinimalBase
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

getTextLength

public int getTextLength()
                  throws IOException,
                         com.fasterxml.jackson.core.JsonParseException
Specified by:
getTextLength in class com.fasterxml.jackson.core.base.ParserMinimalBase
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

getTextOffset

public int getTextOffset()
                  throws IOException,
                         com.fasterxml.jackson.core.JsonParseException
Specified by:
getTextOffset in class com.fasterxml.jackson.core.base.ParserMinimalBase
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

getEmbeddedObject

public Object getEmbeddedObject()
                         throws IOException,
                                com.fasterxml.jackson.core.JsonParseException
Specified by:
getEmbeddedObject in class com.fasterxml.jackson.core.JsonParser
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

getBinaryValue

public byte[] getBinaryValue(com.fasterxml.jackson.core.Base64Variant b64variant)
                      throws IOException,
                             com.fasterxml.jackson.core.JsonParseException
Specified by:
getBinaryValue in class com.fasterxml.jackson.core.base.ParserMinimalBase
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

nextToken

public com.fasterxml.jackson.core.JsonToken nextToken()
                                               throws IOException,
                                                      com.fasterxml.jackson.core.JsonParseException
Specified by:
nextToken in class com.fasterxml.jackson.core.base.ParserMinimalBase
Returns:
Next token from the stream, if any found, or null to indicate end-of-input
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

nextTextValue

public String nextTextValue()
                     throws IOException,
                            com.fasterxml.jackson.core.JsonParseException
Overrides:
nextTextValue in class com.fasterxml.jackson.core.JsonParser
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

nextIntValue

public int nextIntValue(int defaultValue)
                 throws IOException,
                        com.fasterxml.jackson.core.JsonParseException
Overrides:
nextIntValue in class com.fasterxml.jackson.core.JsonParser
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

nextLongValue

public long nextLongValue(long defaultValue)
                   throws IOException,
                          com.fasterxml.jackson.core.JsonParseException
Overrides:
nextLongValue in class com.fasterxml.jackson.core.JsonParser
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

nextBooleanValue

public Boolean nextBooleanValue()
                         throws IOException,
                                com.fasterxml.jackson.core.JsonParseException
Overrides:
nextBooleanValue in class com.fasterxml.jackson.core.JsonParser
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class com.fasterxml.jackson.core.base.ParserBase
Throws:
IOException

parseNumberText

protected com.fasterxml.jackson.core.JsonToken parseNumberText(int ch)
                                                        throws IOException,
                                                               com.fasterxml.jackson.core.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
com.fasterxml.jackson.core.JsonParseException

_handleInvalidNumberStart

protected com.fasterxml.jackson.core.JsonToken _handleInvalidNumberStart(int ch,
                                                                         boolean negative)
                                                                  throws IOException,
                                                                         com.fasterxml.jackson.core.JsonParseException
Method called if expected numeric value (due to leading sign) does not look like a number

Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

_parseFieldName

protected String _parseFieldName(int i)
                          throws IOException,
                                 com.fasterxml.jackson.core.JsonParseException
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

_parseUnquotedFieldName

protected String _parseUnquotedFieldName(int i)
                                  throws IOException,
                                         com.fasterxml.jackson.core.JsonParseException
Method called when we see non-white space character other than double quote, when expecting a field name. In standard mode will just throw an expection; but in non-standard modes may be able to parse name.

Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

_handleUnexpectedValue

protected com.fasterxml.jackson.core.JsonToken _handleUnexpectedValue(int i)
                                                               throws IOException,
                                                                      com.fasterxml.jackson.core.JsonParseException
Method for handling cases where first non-space character of an expected value token is not legal for standard JSON content.

Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

_parseUnquotedString

protected void _parseUnquotedString()
                             throws IOException,
                                    com.fasterxml.jackson.core.JsonParseException
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

_parseUnquotedString2

protected void _parseUnquotedString2()
                              throws IOException,
                                     com.fasterxml.jackson.core.JsonParseException
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

_finishString

protected void _finishString()
                      throws IOException,
                             com.fasterxml.jackson.core.JsonParseException
Specified by:
_finishString in class com.fasterxml.jackson.core.base.ParserBase
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

_finishString2

protected void _finishString2()
                       throws IOException,
                              com.fasterxml.jackson.core.JsonParseException
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

_skipString

protected void _skipString()
                    throws IOException,
                           com.fasterxml.jackson.core.JsonParseException
Method called to skim through rest of unparsed String value, if it is not needed. This can be done bit faster if contents need not be stored for future access.

Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

_decodeEscaped

protected char _decodeEscaped()
                       throws IOException,
                              com.fasterxml.jackson.core.JsonParseException
Overrides:
_decodeEscaped in class com.fasterxml.jackson.core.base.ParserBase
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

_matchToken

protected void _matchToken(String matchStr,
                           int i)
                    throws IOException,
                           com.fasterxml.jackson.core.JsonParseException
Helper method for checking whether input matches expected token

Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

_decodeBase64

protected byte[] _decodeBase64(com.fasterxml.jackson.core.Base64Variant b64variant)
                        throws IOException,
                               com.fasterxml.jackson.core.JsonParseException
Efficient handling for incremental parsing of base64-encoded textual content.

Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

_decodeBase64Escape2

protected int _decodeBase64Escape2(com.fasterxml.jackson.core.Base64Variant b64variant,
                                   char ch,
                                   int index)
                            throws IOException,
                                   com.fasterxml.jackson.core.JsonParseException
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

_reportInvalidToken

protected void _reportInvalidToken(String matchedPart,
                                   String msg)
                            throws IOException,
                                   com.fasterxml.jackson.core.JsonParseException
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException


Copyright © 2013. All Rights Reserved.