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 class
static class
static class
static class
static class
static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected long
private static final byte
private static final byte
private static final byte
private static final byte
private static final String
private static final byte
private static final int
private final byte
static final byte
static final byte
static final byte
private static final byte
static final byte
static final byte
static final byte
protected String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
long
getId()
byte
getType()
getValue()
int
hashCode()
abstract void
protected long
protected String
readString
(DataInput in) toString()
protected void
writeId
(DataOutput out, long id, byte idType) protected void
writeString
(DataOutput out, String string) abstract void
writeTo
(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
public int hashCode() -
writeTo
- Throws:
IOException
-
readFrom
- Throws:
IOException
-
writeId
- Throws:
IOException
-
writeString
- Throws:
IOException
-
readId
- Throws:
IOException
-
readString
- Throws:
IOException
-