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 java.lang.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)
|
Method Summary |
boolean |
equals(java.lang.Object o)
|
long |
getId()
|
byte |
getType()
|
java.lang.String |
getValue()
|
int |
hashCode()
|
abstract void |
readFrom(java.io.DataInput in,
byte idType)
|
protected long |
readId(java.io.DataInput in,
byte idType)
|
protected java.lang.String |
readString(java.io.DataInput in)
|
java.lang.String |
toString()
|
protected void |
writeId(java.io.DataOutput out,
long id,
byte idType)
|
protected void |
writeString(java.io.DataOutput out,
java.lang.String string)
|
abstract void |
writeTo(java.io.DataOutput out,
byte idType)
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
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 java.lang.String value
Token
public Token(byte type)
getType
public byte getType()
getId
public long getId()
getValue
public java.lang.String getValue()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in class java.lang.Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
writeTo
public abstract void writeTo(java.io.DataOutput out,
byte idType)
throws java.io.IOException
- Throws:
java.io.IOException
readFrom
public abstract void readFrom(java.io.DataInput in,
byte idType)
throws java.io.IOException
- Throws:
java.io.IOException
writeId
protected void writeId(java.io.DataOutput out,
long id,
byte idType)
throws java.io.IOException
- Throws:
java.io.IOException
writeString
protected void writeString(java.io.DataOutput out,
java.lang.String string)
throws java.io.IOException
- Throws:
java.io.IOException
readId
protected long readId(java.io.DataInput in,
byte idType)
throws java.io.IOException
- Throws:
java.io.IOException
readString
protected java.lang.String readString(java.io.DataInput in)
throws java.io.IOException
- Throws:
java.io.IOException
Copyright © 2004-2012 XStream. All Rights Reserved.