net.i2p.data
Class SessionTag
java.lang.Object
net.i2p.data.DataStructureImpl
net.i2p.data.SimpleDataStructure
net.i2p.data.SessionTag
- All Implemented Interfaces:
- Serializable, DataStructure
public class SessionTag
- extends SimpleDataStructure
32 bytes, usually of random data.
Changed from ByteArray to SimpleDataStructure in 0.8.2.
- See Also:
- Serialized Form
Method Summary |
int |
hashCode()
SessionTags are generated both locally and by peers, in quantity,
and are used as keys in several datastructures (see TransientSessionKeyManager),
so we use a secure hashCode function. |
int |
length()
The legal length of the byte array in this data structure |
void |
readBytes(InputStream in)
Sets the data. |
void |
setData(byte[] data)
Sets the data. |
BYTE_LENGTH
public static final int BYTE_LENGTH
- See Also:
- Constant Field Values
SessionTag
public SessionTag()
SessionTag
public SessionTag(boolean create)
- Parameters:
create
- if true, instantiate the data array and fill it with random data.
SessionTag
public SessionTag(byte[] val)
length
public int length()
- Description copied from class:
SimpleDataStructure
- The legal length of the byte array in this data structure
- Specified by:
length
in class SimpleDataStructure
setData
public void setData(byte[] data)
- Description copied from class:
SimpleDataStructure
- Sets the data.
- Overrides:
setData
in class SimpleDataStructure
- Parameters:
data
- of correct length, or null
readBytes
public void readBytes(InputStream in)
throws DataFormatException,
IOException
- Description copied from class:
SimpleDataStructure
- Sets the data.
- Specified by:
readBytes
in interface DataStructure
- Overrides:
readBytes
in class SimpleDataStructure
- Parameters:
in
- the stream to read
- Throws:
DataFormatException
- if the data is improperly formatted
IOException
- if there was a problem reading the stream
hashCode
public int hashCode()
- SessionTags are generated both locally and by peers, in quantity,
and are used as keys in several datastructures (see TransientSessionKeyManager),
so we use a secure hashCode function.
- Overrides:
hashCode
in class SimpleDataStructure