public class SessionTag extends SimpleDataStructure
Modifier and Type | Field and Description |
---|---|
static int |
BYTE_LENGTH |
_data
Constructor and Description |
---|
SessionTag() |
SessionTag(boolean create) |
SessionTag(byte[] val) |
Modifier and Type | Method and Description |
---|---|
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.
|
calculateHash, equals, fromBase64, fromByteArray, getData, toBase64, toByteArray, toString, writeBytes
read
public static final int BYTE_LENGTH
public SessionTag()
public SessionTag(boolean create)
create
- if true, instantiate the data array and fill it with random data.public SessionTag(byte[] val)
public int length()
SimpleDataStructure
length
in class SimpleDataStructure
public void setData(byte[] data)
SimpleDataStructure
setData
in class SimpleDataStructure
data
- of correct length, or nullpublic void readBytes(InputStream in) throws DataFormatException, IOException
SimpleDataStructure
readBytes
in interface DataStructure
readBytes
in class SimpleDataStructure
in
- the stream to readDataFormatException
- if the data is improperly formattedIOException
- if there was a problem reading the streampublic int hashCode()
hashCode
in class SimpleDataStructure