org.codehaus.jackson.util
Class TokenBuffer.Segment

java.lang.Object
  extended by org.codehaus.jackson.util.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 Summary
protected  TokenBuffer.Segment _next
           
protected  Object[] _tokens
           
protected  long _tokenTypes
          Bit field used to store types of buffered tokens; 4 bits per token.
static int TOKENS_PER_SEGMENT
           
 
Constructor Summary
TokenBuffer.Segment()
           
 
Method Summary
 TokenBuffer.Segment append(int index, JsonToken tokenType)
           
 TokenBuffer.Segment append(int index, JsonToken tokenType, Object value)
           
 Object get(int index)
           
 TokenBuffer.Segment next()
           
 void set(int index, JsonToken tokenType)
           
 void set(int index, JsonToken tokenType, Object value)
           
 JsonToken type(int index)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOKENS_PER_SEGMENT

public static final int TOKENS_PER_SEGMENT
See Also:
Constant Field Values

_next

protected TokenBuffer.Segment _next

_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
Constructor Detail

TokenBuffer.Segment

public TokenBuffer.Segment()
Method Detail

type

public JsonToken type(int index)

get

public Object get(int index)

next

public TokenBuffer.Segment next()

append

public TokenBuffer.Segment append(int index,
                                  JsonToken tokenType)

append

public TokenBuffer.Segment append(int index,
                                  JsonToken tokenType,
                                  Object value)

set

public void set(int index,
                JsonToken tokenType)

set

public void set(int index,
                JsonToken tokenType,
                Object value)