Top Fields Constructors Methods
tools.jackson.dataformat.smile.async

public Class NonBlockingByteArrayParser

extends NonBlockingParserBase
implements ByteArrayFeeder
Class Inheritance
All Implemented Interfaces
tools.jackson.core.async.ByteArrayFeeder, tools.jackson.core.async.NonBlockingInputFeeder
Static Imports
tools.jackson.dataformat.smile.SmileConstants.BYTE_MARKER_END_OF_STRING

Field Summary

Modifier and TypeField and Description
protected byte[]
_inputBuffer

This buffer is actually provided via NonBlockingInputFeeder

protected int
_origBufferLen

In addition to current buffer pointer, and end pointer, we will also need to know number of bytes originally contained.

Inherited from tools.jackson.dataformat.smile.async.NonBlockingParserBase:
_byteArrayBuilder_endOfInput_inputCopy_inputCopyLen_majorState_majorStateAfterValue_minorState_pending32_pending64MAJOR_ARRAY_ELEMENTMAJOR_CLOSEDMAJOR_INITIALMAJOR_OBJECT_FIELDMAJOR_OBJECT_VALUEMAJOR_ROOTMINOR_HEADER_INITIALMINOR_HEADER_INLINEMINOR_PROPERTY_NAME_2BYTEMINOR_PROPERTY_NAME_LONGMINOR_PROPERTY_NAME_SHORT_ASCIIMINOR_PROPERTY_NAME_SHORT_UNICODEMINOR_VALUE_BINARY_7BIT_BODYMINOR_VALUE_BINARY_7BIT_LENMINOR_VALUE_BINARY_RAW_BODYMINOR_VALUE_BINARY_RAW_LENMINOR_VALUE_NUMBER_BIGDEC_BODYMINOR_VALUE_NUMBER_BIGDEC_LENMINOR_VALUE_NUMBER_BIGDEC_SCALEMINOR_VALUE_NUMBER_BIGINT_BODYMINOR_VALUE_NUMBER_BIGINT_LENMINOR_VALUE_NUMBER_DOUBLEMINOR_VALUE_NUMBER_FLOATMINOR_VALUE_NUMBER_INTMINOR_VALUE_NUMBER_LONGMINOR_VALUE_STRING_LONG_ASCIIMINOR_VALUE_STRING_LONG_UNICODEMINOR_VALUE_STRING_SHARED_2BYTEMINOR_VALUE_STRING_SHORT_ASCIIMINOR_VALUE_STRING_SHORT_UNICODE

Constructor Summary

AccessConstructor and Description
public
NonBlockingByteArrayParser(ObjectReadContext readCtxt, IOContext ioCtxt, int parserFeatures, int smileFeatures, ByteQuadsCanonicalizer sym)

Method Summary

Modifier and TypeMethod and Description
private final boolean
protected final boolean
_decode7BitEncodedTail(int bytesToDecode, int buffered)

private final String
_decodeASCIIText(byte[] inBuf, int inPtr, int len)

private final String
_decodeLongUnicodeName(byte[] inBuf, int inPtr, int len)

private final String
_decodeShortUnicodeText(byte[] inBuf, int inPtr, int
Length between 1 and 64
len
)

Helper method used to decode short Unicode string, length for which actual length (in bytes) is known

private final int
_decodeUTF8_2(int c, int d)

private final int
_decodeUTF8_3(int c, int d, int e)

private final int
_decodeUTF8_4(int c, int d, int e, int f)

private final int
private final JsonToken
private final JsonToken
_finish7BitBinaryLen(int value, int bytesRead)

private final JsonToken
private final JsonToken
_finishBigDecimalLen(int value, int bytesRead)

private final JsonToken
_finishBigDecimalScale(int value, int bytesRead)

private final JsonToken
private final JsonToken
_finishBigIntLen(int value, int bytesRead)

protected final JsonToken
_finishDouble(long value, int bytesRead)

protected final JsonToken
_finishFloat(int value, int bytesRead)

protected JsonToken
_finishHeader(int state)

Helper method that will decode information from a header block that has been detected.

private final JsonToken
_finishInt(int value, int bytesRead)

private final JsonToken
_finishLong(long value, int bytesRead)

private final JsonToken
private final JsonToken
private final JsonToken
private final boolean
private final JsonToken
private final JsonToken
_finishRawBinaryLen(int value, int bytesRead)

protected final JsonToken
_finishToken()

Method called when a (scalar) value type has been detected, but not all of contents have been decoded due to incomplete input available.

private final int
_fourBytesToInt(int ptr)

private final JsonToken
private final JsonToken
private final JsonToken
protected final JsonToken
protected final JsonToken
_startFieldName(int ch)

Method that handles initial token type recognition for token that has to be either PROPERTY_NAME or END_OBJECT.

protected final JsonToken
private final JsonToken
private final JsonToken
private final JsonToken
protected final JsonToken
protected final JsonToken
private final JsonToken
_startShortASCII(final int len)

private final JsonToken
_startShortUnicode(final int len)

private final JsonToken
_startValue(int ch)

Helper method called to detect type of a value token (at any level), and possibly decode it if contained in input buffer.

public void
endOfInput()

Implements tools.jackson.core.async.NonBlockingInputFeeder.endOfInput.

Method that should be called after last chunk of data to parse has been fed (with feedInput in sub-class); can be called regardless of what needMoreInput returns.

public void
feedInput(byte[] buf, int start, int end)

Implements tools.jackson.core.async.ByteArrayFeeder.feedInput.

Method that can be called to feed more data, if (and only if) needMoreInput returns true.

public final boolean
needMoreInput()

Implements tools.jackson.core.async.NonBlockingInputFeeder.needMoreInput.

Method called to check whether it is ok to feed more data: parser returns true if it has no more content to parse (and it is ok to feed more); otherwise false (and no data should yet be fed).

public JsonToken
nextToken()

Implements abstract tools.jackson.core.JsonParser.nextToken.

Main iteration method, which will advance stream enough to determine type of the next token, if any.

public ByteArrayFeeder
nonBlockingInputFeeder()

Overrides tools.jackson.core.JsonParser.nonBlockingInputFeeder.

Method that will either return a feeder instance (if parser uses non-blocking, aka asynchronous access); or null for parsers that use blocking I/O.

public int
releaseBuffered(OutputStream out)

Implements abstract tools.jackson.dataformat.smile.async.NonBlockingParserBase.releaseBuffered.

Method that can be called to push back any content that has been read but not consumed by the parser.

Inherited from tools.jackson.dataformat.smile.async.NonBlockingParserBase:
_addDecodedToSymbols_addSeenStringValue_closeArrayScope_closeInput_closeObjectScope_eofAsNextToken_expandSeenNames_findDecodedFromSymbols_handleSharedName_handleSharedString_initByteArrayBuilder_parseNumericValue_parseNumericValueIfNumber_releaseBuffers2_reportInvalidInitial_reportInvalidOther_reportInvalidSharedName_reportInvalidSharedStringValue_reportMissingHeader_startArrayScope_startObjectScope_valueCompletecanParseAsyncgetBinaryValuegetEmbeddedObjectgetStringgetStringgetStringCharactersgetStringLengthgetStringOffsethasStringCharactersreadBinaryValuestreamReadInputSourcesymbolTableForTests

Field Detail

_inputBufferback to summary
protected byte[] _inputBuffer

This buffer is actually provided via NonBlockingInputFeeder

_origBufferLenback to summary
protected int _origBufferLen

In addition to current buffer pointer, and end pointer, we will also need to know number of bytes originally contained. This is needed to correctly update location information when the block has been completed.

Constructor Detail

NonBlockingByteArrayParserback to summary
public NonBlockingByteArrayParser(ObjectReadContext readCtxt, IOContext ioCtxt, int parserFeatures, int smileFeatures, ByteQuadsCanonicalizer sym)

Method Detail

_decode7BitEncodedback to summary
private final boolean _decode7BitEncoded() throws JacksonException
_decode7BitEncodedTailback to summary
protected final boolean _decode7BitEncodedTail(int bytesToDecode, int buffered) throws JacksonException
_decodeASCIITextback to summary
private final String _decodeASCIIText(byte[] inBuf, int inPtr, int len) throws JacksonException
_decodeLongUnicodeNameback to summary
private final String _decodeLongUnicodeName(byte[] inBuf, int inPtr, int len) throws JacksonException
_decodeShortUnicodeTextback to summary
private final String _decodeShortUnicodeText(byte[] inBuf, int inPtr, int len) throws JacksonException

Helper method used to decode short Unicode string, length for which actual length (in bytes) is known

Parameters
len:int

Length between 1 and 64

_decodeUTF8_2back to summary
private final int _decodeUTF8_2(int c, int d) throws JacksonException
_decodeUTF8_3back to summary
private final int _decodeUTF8_3(int c, int d, int e) throws JacksonException
_decodeUTF8_4back to summary
private final int _decodeUTF8_4(int c, int d, int e, int f) throws JacksonException
_decodeVIntback to summary
private final int _decodeVInt() throws JacksonException
_finish7BitBinaryBodyback to summary
private final JsonToken _finish7BitBinaryBody() throws JacksonException
_finish7BitBinaryLenback to summary
private final JsonToken _finish7BitBinaryLen(int value, int bytesRead) throws JacksonException
_finishBigDecimalBodyback to summary
private final JsonToken _finishBigDecimalBody() throws JacksonException
_finishBigDecimalLenback to summary
private final JsonToken _finishBigDecimalLen(int value, int bytesRead) throws JacksonException
_finishBigDecimalScaleback to summary
private final JsonToken _finishBigDecimalScale(int value, int bytesRead) throws JacksonException
_finishBigIntBodyback to summary
private final JsonToken _finishBigIntBody() throws JacksonException
_finishBigIntLenback to summary
private final JsonToken _finishBigIntLen(int value, int bytesRead) throws JacksonException
_finishDoubleback to summary
protected final JsonToken _finishDouble(long value, int bytesRead) throws JacksonException
_finishFloatback to summary
protected final JsonToken _finishFloat(int value, int bytesRead) throws JacksonException
_finishHeaderback to summary
protected JsonToken _finishHeader(int state) throws JacksonException

Helper method that will decode information from a header block that has been detected.

_finishIntback to summary
private final JsonToken _finishInt(int value, int bytesRead) throws JacksonException
_finishLongback to summary
private final JsonToken _finishLong(long value, int bytesRead) throws JacksonException
_finishLongASCIIback to summary
private final JsonToken _finishLongASCII() throws JacksonException
_finishLongFieldNameback to summary
private final JsonToken _finishLongFieldName(int outPtr) throws JacksonException
_finishLongUnicodeback to summary
private final JsonToken _finishLongUnicode() throws JacksonException
_finishPartialUnicodeCharback to summary
private final boolean _finishPartialUnicodeChar() throws JacksonException
_finishRawBinaryBodyback to summary
private final JsonToken _finishRawBinaryBody() throws JacksonException
_finishRawBinaryLenback to summary
private final JsonToken _finishRawBinaryLen(int value, int bytesRead) throws JacksonException
_finishTokenback to summary
protected final JsonToken _finishToken() throws JacksonException

Method called when a (scalar) value type has been detected, but not all of contents have been decoded due to incomplete input available.

_fourBytesToIntback to summary
private final int _fourBytesToInt(int ptr) throws JacksonException
_start7BitBinaryback to summary
private final JsonToken _start7BitBinary() throws JacksonException
_startBigDecimalback to summary
private final JsonToken _startBigDecimal() throws JacksonException
_startBigIntback to summary
private final JsonToken _startBigInt() throws JacksonException
_startDoubleback to summary
protected final JsonToken _startDouble() throws JacksonException
_startFieldNameback to summary
protected final JsonToken _startFieldName(int ch) throws JacksonException

Method that handles initial token type recognition for token that has to be either PROPERTY_NAME or END_OBJECT.

_startFloatback to summary
protected final JsonToken _startFloat() throws JacksonException
_startIntback to summary
private final JsonToken _startInt() throws JacksonException
_startLongback to summary
private final JsonToken _startLong() throws JacksonException
_startLongASCIIback to summary
private final JsonToken _startLongASCII() throws JacksonException
_startLongUnicodeback to summary
protected final JsonToken _startLongUnicode() throws JacksonException
_startRawBinaryback to summary
protected final JsonToken _startRawBinary() throws JacksonException
_startShortASCIIback to summary
private final JsonToken _startShortASCII(final int len) throws JacksonException
_startShortUnicodeback to summary
private final JsonToken _startShortUnicode(final int len) throws JacksonException
_startValueback to summary
private final JsonToken _startValue(int ch) throws JacksonException

Helper method called to detect type of a value token (at any level), and possibly decode it if contained in input buffer. Note that possible header has been ruled out by caller and is not checked here.

endOfInputback to summary
public void endOfInput()

Implements tools.jackson.core.async.NonBlockingInputFeeder.endOfInput.

Doc from tools.jackson.core.async.NonBlockingInputFeeder.endOfInput.

Method that should be called after last chunk of data to parse has been fed (with feedInput in sub-class); can be called regardless of what needMoreInput returns. After calling this method, no more data can be fed; and parser assumes no more data will be available.

Annotations
@Override
feedInputback to summary
public void feedInput(byte[] buf, int start, int end) throws JacksonException

Implements tools.jackson.core.async.ByteArrayFeeder.feedInput.

Doc from tools.jackson.core.async.ByteArrayFeeder.feedInput.

Method that can be called to feed more data, if (and only if) needMoreInput returns true.

Annotations
@Override
Exceptions
JacksonException:
if the state is such that this method should not be called (has not yet consumed existing input data, or has been marked as closed)
needMoreInputback to summary
public final boolean needMoreInput()

Implements tools.jackson.core.async.NonBlockingInputFeeder.needMoreInput.

Doc from tools.jackson.core.async.NonBlockingInputFeeder.needMoreInput.

Method called to check whether it is ok to feed more data: parser returns true if it has no more content to parse (and it is ok to feed more); otherwise false (and no data should yet be fed).

Annotations
@Override
nextTokenback to summary
public JsonToken nextToken() throws JacksonException

Implements abstract tools.jackson.core.JsonParser.nextToken.

Doc from tools.jackson.core.JsonParser.nextToken.

Main iteration method, which will advance stream enough to determine type of the next token, if any. If none remaining (stream has no content other than possible white space before ending), null will be returned.

Annotations
@Override
Exceptions
JacksonException:
for low-level read issues
nonBlockingInputFeederback to summary
public ByteArrayFeeder nonBlockingInputFeeder()

Overrides tools.jackson.core.JsonParser.nonBlockingInputFeeder.

Doc from tools.jackson.core.JsonParser.nonBlockingInputFeeder.

Method that will either return a feeder instance (if parser uses non-blocking, aka asynchronous access); or null for parsers that use blocking I/O.

Annotations
@Override
releaseBufferedback to summary
public int releaseBuffered(OutputStream out) throws JacksonException

Implements abstract tools.jackson.dataformat.smile.async.NonBlockingParserBase.releaseBuffered.

Doc from tools.jackson.core.JsonParser.releaseBuffered.

Method that can be called to push back any content that has been read but not consumed by the parser. This is usually done after reading all content of interest using parser. Content is released by writing it to given stream if possible; if underlying input is byte-based it can released, if not (char-based) it cannot.

Annotations
@Override
Exceptions
JacksonException:
if write to stream threw exception