package com.fasterxml.jackson.dataformat.smile;
import static com.fasterxml.jackson.dataformat.smile.SmileConstants.BYTE_MARKER_END_OF_STRING;
Enumeration that defines all togglable features for Smile generators.
Feature that determines whether 4-byte Smile header is mandatory in input,
or optional. If enabled, it means that only input that starts with the header
is accepted as valid; if disabled, header is optional. In latter case,r
settings for content are assumed to be defaults.
Method that calculates bit set (flags) of all features that
are enabled by default.
private Feature(boolean defaultState) {
private final static int[] NO_INTS = new int[0];
Codec used for data binding when (if) requested.
Flag that indicates whether content can legally have raw (unquoted)
binary data. Since this information is included both in header and
in actual binary data blocks there is redundancy, and we want to
ensure settings are compliant. Using application may also want to
know this setting in case it does some direct (random) access.
Helper object used for low-level recycling of Smile-generator
specific buffers.
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.
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.
Flag that indicates whether the input buffer is recycable (and
needs to be returned to recycler once we are done) or not.
If it is not, it also means that parser can NOT modify underlying
buffer.
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)
Type byte of the current token
Specific flag that is set when we encountered a 32-bit
floating point value; needed since numeric super classes do
not track distinction between float and double, but Smile
format does, and we want to retain that separation.
Symbol table that contains field names encountered so far
Temporary buffer used for name parsing.
Quads used for hash calculation
Array of recently seen field names, which may be back referenced
by later fields.
Defaults set to enable handling even if no header found.
Array of recently seen field names, which may be back referenced
by later fields
Defaults set to disable handling if no header found.
ThreadLocal
contains a
java.lang.ref.SoftReference
to a buffer recycler used to provide a low-cost
buffer recycling for Smile-specific buffers.
InputStream in, byte[] inputBuffer, int start, int end,
boolean bufferRecyclable)
super(ctxt, parserFeatures);
Helper method called when it looks like input might contain the signature;
and it is necessary to detect and handle signature to get configuration
information it might have.
- Returns:
- True if valid signature was found and handled; false if not
protected boolean handleSignature(boolean consumeFirstByte, boolean throwException)
_reportError("Malformed content: signature not valid, starts with 0x3a but followed by 0x"
_reportError("Malformed content: signature not valid, starts with 0x3a, 0x29, but followed by 0x"
int versionBits = (ch >> 4) & 0x0F;
_reportError("Header version number bits (0x"+Integer.toHexString(versionBits)+") indicate unrecognized version; only 0x0 handled by parser");
Overridden since we do not really have character-based locations,
but we do have byte offset to specify.
Overridden since we do not really have character-based locations,
but we do have byte offset to specify.
Helper method that will try to load at least specified number bytes in
input buffer, possible moving existing data around if necessary
throw new IOException("InputStream.read() returned 0 characters when trying to read "+amount+" bytes");
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).
if (nameBuf != null && nameBuf.length > 0) {
if (valueBuf != null && valueBuf.length > 0) {
switch ((ch >> 5) & 0x7) {
int typeBits = ch & 0x1F;
if ((typeBits & 0x3) <= 0x2) {
int subtype = typeBits & 0x3;
_reportError("Unrecognized token byte 0x3A (malformed segment header?");
_reportError("Invalid type marker byte 0xFB in value mode (would be END_OBJECT in key mode)");
int len = oldShared.length;
newShared = new String[newSize];
System.arraycopy(oldShared, 0, newShared, 0, oldShared.length);
final int byteLen = nameBytes.length;
int index = ((ch & 0x3) << 8) + (_inputBuffer[ptr++] & 0xFF);
int len = 1 + (ch & 0x3f);
switch ((ch >> 5) & 0x7) {
int typeBits = ch & 0x1F;
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.
int type = (tb >> 5) & 0x7;
if (type == 2 || type == 3) {
if (type == 4 || type == 5) {