Class TokenBuffer.Segment

  • Enclosing class:
    TokenBuffer

    protected static final class TokenBuffer.Segment
    extends java.lang.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 Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.TreeMap<java.lang.Integer,​java.lang.Object> _nativeIds
      Lazily constructed Map for storing native type and object ids, if any
      protected TokenBuffer.Segment _next  
      protected java.lang.Object[] _tokens  
      protected long _tokenTypes
      Bit field used to store types of buffered tokens; 4 bits per token.
      private static com.fasterxml.jackson.core.JsonToken[] TOKEN_TYPES_BY_INDEX
      Static array used for fast conversion between token markers and matching JsonToken instances
      static int TOKENS_PER_SEGMENT  
    • Constructor Summary

      Constructors 
      Constructor Description
      Segment()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private int _objectIdIndex​(int i)  
      private int _typeIdIndex​(int i)  
      TokenBuffer.Segment append​(int index, com.fasterxml.jackson.core.JsonToken tokenType)  
      TokenBuffer.Segment append​(int index, com.fasterxml.jackson.core.JsonToken tokenType, java.lang.Object value)  
      TokenBuffer.Segment append​(int index, com.fasterxml.jackson.core.JsonToken tokenType, java.lang.Object objectId, java.lang.Object typeId)  
      TokenBuffer.Segment append​(int index, com.fasterxml.jackson.core.JsonToken tokenType, java.lang.Object value, java.lang.Object objectId, java.lang.Object typeId)  
      private void assignNativeIds​(int index, java.lang.Object objectId, java.lang.Object typeId)  
      private java.lang.Object findObjectId​(int index)  
      private java.lang.Object findTypeId​(int index)  
      java.lang.Object get​(int index)  
      boolean hasIds()
      Accessor for checking whether this segment may have native type or object ids.
      TokenBuffer.Segment next()  
      int rawType​(int index)  
      private void set​(int index, com.fasterxml.jackson.core.JsonToken tokenType)  
      private void set​(int index, com.fasterxml.jackson.core.JsonToken tokenType, java.lang.Object value)  
      private void set​(int index, com.fasterxml.jackson.core.JsonToken tokenType, java.lang.Object objectId, java.lang.Object typeId)  
      private void set​(int index, com.fasterxml.jackson.core.JsonToken tokenType, java.lang.Object value, java.lang.Object objectId, java.lang.Object typeId)  
      com.fasterxml.jackson.core.JsonToken type​(int index)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • TOKEN_TYPES_BY_INDEX

        private static final com.fasterxml.jackson.core.JsonToken[] TOKEN_TYPES_BY_INDEX
        Static array used for fast conversion between token markers and matching JsonToken instances
      • _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 java.lang.Object[] _tokens
      • _nativeIds

        protected java.util.TreeMap<java.lang.Integer,​java.lang.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 java.lang.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)
      • append

        public TokenBuffer.Segment append​(int index,
                                          com.fasterxml.jackson.core.JsonToken tokenType,
                                          java.lang.Object objectId,
                                          java.lang.Object typeId)
      • append

        public TokenBuffer.Segment append​(int index,
                                          com.fasterxml.jackson.core.JsonToken tokenType,
                                          java.lang.Object value)
      • append

        public TokenBuffer.Segment append​(int index,
                                          com.fasterxml.jackson.core.JsonToken tokenType,
                                          java.lang.Object value,
                                          java.lang.Object objectId,
                                          java.lang.Object typeId)
      • set

        private void set​(int index,
                         com.fasterxml.jackson.core.JsonToken tokenType)
      • set

        private void set​(int index,
                         com.fasterxml.jackson.core.JsonToken tokenType,
                         java.lang.Object objectId,
                         java.lang.Object typeId)
      • set

        private void set​(int index,
                         com.fasterxml.jackson.core.JsonToken tokenType,
                         java.lang.Object value)
      • set

        private void set​(int index,
                         com.fasterxml.jackson.core.JsonToken tokenType,
                         java.lang.Object value,
                         java.lang.Object objectId,
                         java.lang.Object typeId)
      • assignNativeIds

        private final void assignNativeIds​(int index,
                                           java.lang.Object objectId,
                                           java.lang.Object typeId)
      • findObjectId

        private java.lang.Object findObjectId​(int index)
        Since:
        2.3
      • findTypeId

        private java.lang.Object findTypeId​(int index)
        Since:
        2.3
      • _typeIdIndex

        private final int _typeIdIndex​(int i)
      • _objectIdIndex

        private final int _objectIdIndex​(int i)