Package 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
-
-
Field Summary
Fields Modifier and Type Field Description static intBYTE_LENGTH-
Fields inherited from class net.i2p.data.SimpleDataStructure
_data
-
-
Constructor Summary
Constructors Constructor Description SessionTag()SessionTag(boolean create)SessionTag(byte[] val)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description inthashCode()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.intlength()The legal length of the byte array in this data structurevoidreadBytes(InputStream in)Sets the data.voidsetData(byte[] data)Sets the data.-
Methods inherited from class net.i2p.data.SimpleDataStructure
calculateHash, equals, fromBase64, fromByteArray, getData, toBase64, toByteArray, toString, writeBytes
-
Methods inherited from class net.i2p.data.DataStructureImpl
read
-
-
-
-
Field Detail
-
BYTE_LENGTH
public static final int BYTE_LENGTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
length
public int length()
Description copied from class:SimpleDataStructureThe legal length of the byte array in this data structure- Specified by:
lengthin classSimpleDataStructure
-
setData
public void setData(byte[] data)
Description copied from class:SimpleDataStructureSets the data.- Overrides:
setDatain classSimpleDataStructure- Parameters:
data- of correct length, or null
-
readBytes
public void readBytes(InputStream in) throws DataFormatException, IOException
Description copied from class:SimpleDataStructureSets the data.- Specified by:
readBytesin interfaceDataStructure- Overrides:
readBytesin classSimpleDataStructure- Parameters:
in- the stream to read- Throws:
DataFormatException- if the data is improperly formattedIOException- 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:
hashCodein classSimpleDataStructure
-
-