|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.limegroup.gnutella.GUID
A 16-bit globally unique ID. Immutable.
Let the bytes of a GUID G be labelled G[0]..G[15]. All bytes are unsigned. Let a "short" be a 2 byte little-endian** unsigned number. Let AB be the short formed by concatenating bytes A and B, with B being the most significant byte. LimeWire GUID's have the following properties:
In addition, LimeWire GUIDs may be marked as follows:
Nested Class Summary | |
static class |
GUID.GUIDByteComparator
Compares 16-byte arrays (raw GUIDs) lexically. |
static class |
GUID.GUIDComparator
Compares GUID's lexically. |
Constructor Summary | |
GUID()
Creates a new Globally Unique Identifier (GUID). |
|
GUID(byte[] bytes)
Creates a new GUID instance with the specified array of unique bytes. |
Method Summary | |
static boolean |
addressesMatch(byte[] guidBytes,
byte[] ip,
int port)
|
boolean |
addressesMatch(byte[] ip,
int port)
Same as addressesMatch(this.bytes, ....) |
byte[] |
bytes()
Warning: this exposes the rep! Do not modify returned value. |
int |
compareTo(java.lang.Object o)
Compares this GUID to o, lexically. |
boolean |
equals(java.lang.Object o)
|
static byte[] |
fromHexString(java.lang.String sguid)
Create a GUID bytes from a hex string version. |
java.lang.String |
getIP()
Same as getIP(this.bytes) |
static java.lang.String |
getIP(byte[] guidBytes)
Gets bytes 0-4 as a dotted ip address. |
int |
getPort()
Same as getPort(this.bytes) |
static int |
getPort(byte[] guidBytes)
Gets bytes 13-14 as a port. |
int |
hashCode()
|
boolean |
isLimeGUID()
Same as isLimeGUID(this.bytes) |
static boolean |
isLimeGUID(byte[] bytes)
Returns true if this is a specially marked LimeWire GUID. |
boolean |
isLimeRequeryGUID()
Same is isLimeRequeryGUID(this.bytes) |
static boolean |
isLimeRequeryGUID(byte[] bytes)
Returns true if this is a specially marked Requery GUID from any version of LimeWire. |
static boolean |
isLimeRequeryGUID(byte[] bytes,
int version)
Returns true if this is a specially marked LimeWire Requery GUID. |
boolean |
isLimeRequeryGUID(int version)
Same as isLimeRequeryGUID(this.bytes, version) |
boolean |
isNewGUID()
Same as isNewGUID(this.bytes). |
static boolean |
isNewGUID(byte[] bytes)
Returns true if this is a GUID from newer Gnutella clients, e.g., LimeWire and BearShare. |
boolean |
isWindowsGUID()
Same as isWindowsGUID(this.bytes). |
static boolean |
isWindowsGUID(byte[] bytes)
Returns true if this is a GUID created by the Windows CoCreateGUID() routine. |
static byte[] |
makeAddressEncodedGuid(byte[] ip,
int port)
Create a guid with an ip and port encoded within. |
static byte[] |
makeGuid()
Returns the bytes for a new GUID. |
static byte[] |
makeGuidRequery()
|
java.lang.String |
toHexString()
Create a hex version of a GUID for compact display and storage Note that the client guid should be read in with the Integer.parseByte(String s, int radix) call like this in reverse |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public GUID()
public GUID(byte[] bytes)
bytes
- the array of unique bytesMethod Detail |
public static byte[] makeGuid()
public static byte[] makeGuidRequery()
public static byte[] makeAddressEncodedGuid(byte[] ip, int port) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- thrown if ip.length != 4 or if the
port is not a valid value.public boolean isLimeGUID()
public boolean isLimeRequeryGUID(int version)
public boolean isLimeRequeryGUID()
public boolean addressesMatch(byte[] ip, int port) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public java.lang.String getIP()
public int getPort()
public static boolean isLimeGUID(byte[] bytes)
public static boolean isLimeRequeryGUID(byte[] bytes)
public static boolean isLimeRequeryGUID(byte[] bytes, int version)
version
- The version of RequeryGUID you want to test for. 0 for
requeries up to 2.2.4, 1 for requeries between 2.2.4 and all 2.3s, and 2
for current requeries....public final boolean isWindowsGUID()
public static boolean isWindowsGUID(byte[] bytes)
public static boolean addressesMatch(byte[] guidBytes, byte[] ip, int port) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- thrown if ip.length != 4 or if the
port is not a valid value.public static java.lang.String getIP(byte[] guidBytes)
public static int getPort(byte[] guidBytes)
public final boolean isNewGUID()
public static boolean isNewGUID(byte[] bytes)
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
public boolean equals(java.lang.Object o)
public int hashCode()
public byte[] bytes()
public java.lang.String toString()
public java.lang.String toHexString()
public static byte[] fromHexString(java.lang.String sguid) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |