com.thoughtworks.xstream.io.binary
Class Token
java.lang.Object
com.thoughtworks.xstream.io.binary.Token
- Direct Known Subclasses:
- Token.Attribute, Token.EndNode, Token.MapIdToValue, Token.StartNode, Token.Value
public abstract class Token
- extends Object
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
- Author:
- Joe Walnes
- See Also:
BinaryStreamReader
,
BinaryStreamWriter
Constructor Summary |
Token(byte type)
|
TYPE_VERSION
public static final byte TYPE_VERSION
- See Also:
- Constant Field Values
TYPE_MAP_ID_TO_VALUE
public static final byte TYPE_MAP_ID_TO_VALUE
- See Also:
- Constant Field Values
TYPE_START_NODE
public static final byte TYPE_START_NODE
- See Also:
- Constant Field Values
TYPE_END_NODE
public static final byte TYPE_END_NODE
- See Also:
- Constant Field Values
TYPE_ATTRIBUTE
public static final byte TYPE_ATTRIBUTE
- See Also:
- Constant Field Values
TYPE_VALUE
public static final byte TYPE_VALUE
- See Also:
- Constant Field Values
id
protected long id
value
protected String value
Token
public Token(byte type)
getType
public byte getType()
getId
public long getId()
getValue
public String getValue()
toString
public String toString()
- Overrides:
toString
in class Object
equals
public boolean equals(Object o)
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
writeTo
public abstract void writeTo(DataOutput out,
byte idType)
throws IOException
- Throws:
IOException
readFrom
public abstract void readFrom(DataInput in,
byte idType)
throws IOException
- Throws:
IOException
writeId
protected void writeId(DataOutput out,
long id,
byte idType)
throws IOException
- Throws:
IOException
writeString
protected void writeString(DataOutput out,
String string)
throws IOException
- Throws:
IOException
readId
protected long readId(DataInput in,
byte idType)
throws IOException
- Throws:
IOException
readString
protected String readString(DataInput in)
throws IOException
- Throws:
IOException
Copyright © 2004-2014 XStream. All Rights Reserved.