Class TokenBuffer.Segment

  • Enclosing class:
    TokenBuffer

    protected static final class TokenBuffer.Segment
    extends Object
    Individual segment of TokenBuffer that can store up to 16 tokens (limited by 4 bits per token type marker requirement). Current implementation uses fixed length array; could alternatively use 16 distinct fields and switch statement (slightly more efficient storage, slightly slower access)
    • Field Detail

      • _tokenTypes

        protected long _tokenTypes
        Bit field used to store types of buffered tokens; 4 bits per token. Value 0 is reserved for "not in use"
      • _tokens

        protected final Object[] _tokens
      • _nativeIds

        protected TreeMap<Integer,​Object> _nativeIds
        Lazily constructed Map for storing native type and object ids, if any
    • Constructor Detail

      • Segment

        public Segment()
    • Method Detail

      • type

        public com.fasterxml.jackson.core.JsonToken type​(int index)
      • rawType

        public int rawType​(int index)
      • get

        public Object get​(int index)
      • hasIds

        public boolean hasIds()
        Accessor for checking whether this segment may have native type or object ids.
      • append

        public TokenBuffer.Segment append​(int index,
                                          com.fasterxml.jackson.core.JsonToken tokenType)