Class Token
java.lang.Object
com.thoughtworks.xstream.io.binary.Token
- Direct Known Subclasses:
Token.Attribute, Token.EndNode, Token.MapIdToValue, Token.StartNode, Token.Value
Represents the Tokens stored in the binary stream used by
BinaryStreamReader and BinaryStreamWriter.
A token consists of a type and (depending on this type) it may additionally have an ID (positive long number) and/or a value (String).
The first byte of the token represents how many subsequent bytes are used by the ID.
- Since:
- 1.2
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longprivate static final byteprivate static final byteprivate static final byteprivate static final byteprivate static final Stringprivate static final byteprivate static final intprivate final bytestatic final bytestatic final bytestatic final byteprivate static final bytestatic final bytestatic final bytestatic final byteprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanlonggetId()bytegetType()getValue()inthashCode()abstract voidprotected longprotected StringreadString(DataInput in) toString()protected voidwriteId(DataOutput out, long id, byte idType) protected voidwriteString(DataOutput out, String string) abstract voidwriteTo(DataOutput out, byte idType)
-
Field Details
-
TYPE_MASK
private static final byte TYPE_MASK- See Also:
-
TYPE_VERSION
public static final byte TYPE_VERSION- See Also:
-
TYPE_MAP_ID_TO_VALUE
public static final byte TYPE_MAP_ID_TO_VALUE- See Also:
-
TYPE_START_NODE
public static final byte TYPE_START_NODE- See Also:
-
TYPE_END_NODE
public static final byte TYPE_END_NODE- See Also:
-
TYPE_ATTRIBUTE
public static final byte TYPE_ATTRIBUTE- See Also:
-
TYPE_VALUE
public static final byte TYPE_VALUE- See Also:
-
ID_MASK
private static final byte ID_MASK- See Also:
-
ID_ONE_BYTE
private static final byte ID_ONE_BYTE- See Also:
-
ID_TWO_BYTES
private static final byte ID_TWO_BYTES- See Also:
-
ID_FOUR_BYTES
private static final byte ID_FOUR_BYTES- See Also:
-
ID_EIGHT_BYTES
private static final byte ID_EIGHT_BYTES- See Also:
-
ID_SPLITTED
- See Also:
-
MAX_UTF8_LENGTH
private static final int MAX_UTF8_LENGTH- See Also:
-
type
private final byte type -
id
protected long id -
value
-
-
Constructor Details
-
Token
public Token(byte type)
-
-
Method Details
-
getType
public byte getType() -
getId
public long getId() -
getValue
-
toString
-
equals
-
hashCode
-
writeTo
- Throws:
IOException
-
readFrom
- Throws:
IOException
-
writeId
- Throws:
IOException
-
writeString
- Throws:
IOException
-
readId
- Throws:
IOException
-
readString
- Throws:
IOException
-