|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.limegroup.gnutella.util.NetworkUtils
This class handles common utility functions for networking tasks.
Method Summary | |
static java.lang.String |
ip2string(byte[] ip)
Returns the ip (given in BIG-endian) format as standard dotted-decimal, e.g., 192.168.0.1 |
static java.lang.String |
ip2string(byte[] ip,
int offset)
Returns the ip (given in BIG-endian) format of buf[offset]...buf[offset+3] as standard dotted-decimal, e.g., 192.168.0.1 |
static boolean |
isCloseIP(byte[] addr0,
byte[] addr1)
Returns whether or not the two ip addresses share the same first octet in their address. |
static boolean |
isLocalAddress(java.net.InetAddress addr)
Returns whether or not the supplied address is a local address. |
static boolean |
isMe(java.lang.String host,
int port)
If host is not a valid host address, returns false. |
static boolean |
isPrivate()
Returns whether or not this node has a private address. |
static boolean |
isPrivateAddress(byte[] address)
Checks to see if the given address is a firewalled address. |
static boolean |
isPrivateAddress(java.net.InetAddress address)
Utility method for determing whether or not the given address is private taking an InetAddress object as argument like the isLocalAddress(InetAddress) method. |
static boolean |
isPrivateAddress(java.lang.String address)
Utility method for determing whether or not the given address is private. |
static boolean |
isValidAddress(byte[] addr)
Returns whether or not the specified address is valid. |
static boolean |
isValidAddress(java.net.InetAddress addr)
Returns whether or not the specified InetAddress is valid. |
static boolean |
isValidAddress(java.lang.String host)
Returns whether or not the specified host is a valid address. |
static boolean |
isValidPort(int port)
Returns whether or not the specified port is within the valid range of ports. |
static boolean |
isVeryCloseIP(byte[] addr)
Returns whether or not the given ip address shares the same first three octets as the address for this node -- the most common indication that they may be on the same network. |
static boolean |
isVeryCloseIP(byte[] addr0,
byte[] addr1)
Returns whether or not the two ip addresses share the same first two octets in their address -- the most common indication that they may be on the same network. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static boolean isValidPort(int port)
port
- the port number to checkpublic static boolean isValidAddress(byte[] addr)
public static boolean isValidAddress(java.net.InetAddress addr)
public static boolean isValidAddress(java.lang.String host)
public static boolean isLocalAddress(java.net.InetAddress addr)
public static boolean isCloseIP(byte[] addr0, byte[] addr1)
addr0
- the first address to compareaddr1
- the second address to comparepublic static boolean isVeryCloseIP(byte[] addr0, byte[] addr1)
addr0
- the first address to compareaddr1
- the second address to comparepublic static boolean isVeryCloseIP(byte[] addr)
addr
- the address to comparepublic static boolean isPrivate()
public static boolean isPrivateAddress(byte[] address)
address
- the address to checkpublic static boolean isPrivateAddress(java.net.InetAddress address)
public static boolean isPrivateAddress(java.lang.String address)
public static final java.lang.String ip2string(byte[] ip)
ip
- the ip address in BIG-endian format
public static final java.lang.String ip2string(byte[] ip, int offset)
ip
- the IP address to convertoffset
- the offset into the IP array to convert
public static boolean isMe(java.lang.String host, int port)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |