|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.klomp.snark.PeerID
public class PeerID
Constructor Summary | |
---|---|
PeerID(BDecoder be)
Creates a PeerID from a BDecoder. |
|
PeerID(byte[] id,
Destination address)
|
|
PeerID(java.util.Map m)
Creates a PeerID from a Map containing BEncoded peer id, ip and port. |
Method Summary | |
---|---|
int |
compareTo(java.lang.Object o)
Compares port, address and id. |
boolean |
equals(java.lang.Object o)
Two PeerIDs are equal when they have the same id, address and port. |
Destination |
getAddress()
|
byte[] |
getID()
|
int |
getPort()
|
int |
hashCode()
The hash code of a PeerID is the exclusive or of all id bytes. |
static java.lang.String |
idencode(byte[] bs)
Encode an id as a hex encoded string and remove leading zeros. |
boolean |
sameID(PeerID pid)
Returns true if and only if this peerID and the given peerID have the same 20 bytes as ID. |
java.lang.String |
toString()
Returns the String "id@address" where id is the base64 encoded id and address is the base64 dest (was the base64 hash of the dest) which should match what the bytemonsoon tracker reports on its web pages. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PeerID(byte[] id, Destination address)
public PeerID(BDecoder be) throws java.io.IOException
java.io.IOException
public PeerID(java.util.Map m) throws InvalidBEncodingException, java.net.UnknownHostException
InvalidBEncodingException
java.net.UnknownHostException
Method Detail |
---|
public byte[] getID()
public Destination getAddress()
public int getPort()
public int hashCode()
hashCode
in class java.lang.Object
public boolean sameID(PeerID pid)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String idencode(byte[] bs)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |