DataStructureclass NodeInfo extends SimpleDataStructure
| 修飾子とタイプ | フィールド | 説明 |
|---|---|---|
static int |
LENGTH |
_data| コンストラクタ | 説明 |
|---|---|
NodeInfo(byte[] compactInfo,
int offset) |
No Destination yet available
|
NodeInfo(java.lang.String s) |
Create from persistent storage string.
|
NodeInfo(Destination dest,
int port) |
With a fake NID used for pings
|
NodeInfo(NID nID,
Destination dest,
int port) |
Use this if we have the full destination
|
NodeInfo(NID nID,
Hash hash,
int port) |
No Destination yet available
|
| 修飾子とタイプ | メソッド | 説明 |
|---|---|---|
Hash |
calculateHash() |
Calculate the SHA256 value of this object (useful for a few scenarios)
|
boolean |
equals(java.lang.Object o) |
Warning - this returns true for two different classes with the same size
and same data, e.g.
|
static NID |
generateNID(Hash h,
int p,
RandomSource random) |
Generate a secure NID that matches the Hash and port.
|
Destination |
getDestination() |
|
Hash |
getHash() |
|
NID |
getNID() |
|
int |
getPort() |
|
int |
hashCode() |
We assume the data has enough randomness in it, so use the first 4 bytes for speed.
|
long |
lastSeen() |
|
int |
length() |
The legal length of the byte array in this data structure
|
void |
setDestination(Destination dest) |
This can come in later but the hash must match.
|
java.lang.String |
toPersistentString() |
To persistent storage string.
|
java.lang.String |
toString() |
readfromBase64, fromByteArray, getData, readBytes, setData, toBase64, toByteArray, writeBytespublic static final int LENGTH
public NodeInfo(Destination dest, int port)
public NodeInfo(NID nID, Destination dest, int port)
java.lang.IllegalArgumentExceptionpublic NodeInfo(NID nID, Hash hash, int port)
java.lang.IllegalArgumentExceptionpublic NodeInfo(byte[] compactInfo,
int offset)
compactInfo - 20 byte node ID, 32 byte destHash, 2 byte portoffset - starting at this offset in compactInfojava.lang.IllegalArgumentExceptionjava.lang.ArrayIndexOutOfBoundsExceptionpublic NodeInfo(java.lang.String s)
throws DataFormatException
java.lang.IllegalArgumentExceptionDataFormatExceptionpublic static NID generateNID(Hash h, int p, RandomSource random)
java.lang.IllegalArgumentExceptionpublic int length()
SimpleDataStructurelength クラス内 SimpleDataStructurepublic NID getNID()
public Destination getDestination()
public Hash getHash()
public Hash calculateHash()
DataStructurecalculateHash インタフェース内 DataStructurecalculateHash クラス内 SimpleDataStructurepublic void setDestination(Destination dest) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException - if hash of dest doesn't match previous hashpublic int getPort()
public long lastSeen()
public int hashCode()
SimpleDataStructurehashCode クラス内 SimpleDataStructurepublic boolean equals(java.lang.Object o)
SimpleDataStructureequals クラス内 SimpleDataStructurepublic java.lang.String toString()
toString クラス内 SimpleDataStructurepublic java.lang.String toPersistentString()