|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.limegroup.gnutella.Endpoint
public class Endpoint
Immutable IP/port pair. Also contains an optional number and size of files, mainly for legacy reasons.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.limewire.io.IpPort |
|---|
IpPort.IpComparator, IpPort.IpPortComparator |
| Nested classes/interfaces inherited from interface org.limewire.io.Address |
|---|
Address.EventType |
| Field Summary |
|---|
| Fields inherited from interface org.limewire.io.Connectable |
|---|
COMPARATOR, EMPTY_LIST, EMPTY_SET |
| Fields inherited from interface org.limewire.io.IpPort |
|---|
IP_COMPARATOR |
| Constructor Summary | |
|---|---|
protected |
Endpoint()
|
|
Endpoint(byte[] hostBytes,
int port)
Creates a new Endpoint instance |
|
Endpoint(byte[] hostBytes,
int port,
long files,
long kbytes)
Creates a new Endpoint instance |
|
Endpoint(Endpoint ep)
Constructs a new endpoint from pre-existing endpoint by copying the fields |
|
Endpoint(InetAddress addr,
int port)
|
|
Endpoint(String hostAndPort)
Returns a new Endpoint from a Gnutella-style host/port pair: If hostAndPort is of the format "host:port", where port is a number, returns new Endpoint(host, port). |
|
Endpoint(String hostAndPort,
boolean requireNumeric)
Same as new Endpoint(hostAndPort) but with additional restrictions on hostAndPart; if requireNumeric==true and the host part of hostAndPort is not as a numeric dotted-quad IP address, throws IllegalArgumentException. |
|
Endpoint(String hostAndPort,
boolean requireNumeric,
boolean strict)
Constructs a new endpoint. |
|
Endpoint(String hostname,
int port)
|
|
Endpoint(String hostname,
int port,
boolean strict)
Constructs a new endpoint using the specific hostname & port. |
|
Endpoint(String hostname,
int port,
long files,
long kbytes)
|
| Method Summary | |
|---|---|
protected Object |
clone()
|
boolean |
equals(Object o)
Endpoints are equal if their hostnames and ports are. |
String |
getAddress()
Assessor for the address string. |
String |
getAddressDescription()
|
long |
getFiles()
Returns the number of files the host has, or -1 if I don't know |
byte[] |
getHostBytes()
This method returns the IP of the end point as an array of bytes |
InetAddress |
getInetAddress()
Accessor for the InetAddress instance for this host. |
InetSocketAddress |
getInetSocketAddress()
Accessor for the InetSocketAddress that can describe the IP & Port. |
long |
getKbytes()
Returns the size of all files the host has, in kilobytes, or -1 if I don't know, it also makes sure that the kbytes/files ratio is not ridiculous, in which case it normalizes the values |
int |
getPort()
Assessor for the port this host is listening on. |
int |
hashCode()
|
boolean |
isSameSubnet(Endpoint other)
|
boolean |
isTLSCapable()
Determines if this endpoint supports TLS. |
boolean |
isUDPHostCache()
Determines if this is a UDP host cache. |
void |
normalizeFilesAndSize()
If the number of files or the kbytes exceed certain limit, it considers them as false data, and initializes the number of files as well as kbytes to zero in that case |
void |
setFiles(long files)
Sets the number of files the host has |
void |
setHostname(String hostname)
|
void |
setKbytes(long kbytes)
Sets the size of all files the host has, in kilobytes, |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected Endpoint()
public Endpoint(String hostAndPort)
throws IllegalArgumentException
IllegalArgumentException
public Endpoint(String hostAndPort,
boolean requireNumeric)
new Endpoint("www.limewire.org:6346", false) ==> ok
new Endpoint("not a url:6346", false) ==> ok
new Endpoint("www.limewire.org:6346", true) ==> IllegalArgumentException
new Endpoint("64.61.25.172:6346", true) ==> ok
new Endpoint("64.61.25.172", true) ==> ok
new Endpoint("127.0.0.1:ABC", false) ==> IllegalArgumentException
If requireNumeric is true no DNS lookups are ever involved.
If requireNumeric is false a DNS lookup MAY be performed if the hostname
is not numeric.
(String))
public Endpoint(String hostAndPort,
boolean requireNumeric,
boolean strict)
public Endpoint(String hostname,
int port)
public Endpoint(InetAddress addr,
int port)
public Endpoint(String hostname,
int port,
boolean strict)
public Endpoint(byte[] hostBytes,
int port)
hostBytes - IP address of the host (MSB first)port - The port number for the host
public Endpoint(String hostname,
int port,
long files,
long kbytes)
files - the number of files the host haskbytes - the size of all of the files, in kilobytes
public Endpoint(byte[] hostBytes,
int port,
long files,
long kbytes)
hostBytes - IP address of the host (MSB first)port - The port number for the hostfiles - the number of files the host haskbytes - the size of all of the files, in kilobytespublic Endpoint(Endpoint ep)
ep - The endpoint from whom to initialize the member fields of
this new endpoint| Method Detail |
|---|
public String toString()
toString in class Objectpublic String getAddress()
IpPort
getAddress in interface IpPortpublic InetAddress getInetAddress()
getInetAddress in interface IpPortpublic void setHostname(String hostname)
public int getPort()
IpPort
getPort in interface IpPortpublic InetSocketAddress getInetSocketAddress()
IpPort
getInetSocketAddress in interface IpPortpublic String getAddressDescription()
getAddressDescription in interface Addresspublic long getFiles()
public void setFiles(long files)
public long getKbytes()
public void normalizeFilesAndSize()
public void setKbytes(long kbytes)
public boolean equals(Object o)
equals in interface Addressequals in class Objectpublic int hashCode()
hashCode in interface AddresshashCode in class Objectprotected Object clone()
clone in class Object
public byte[] getHostBytes()
throws UnknownHostException
UnknownHostExceptionpublic boolean isSameSubnet(Endpoint other)
public boolean isUDPHostCache()
public boolean isTLSCapable()
isTLSCapable in interface Connectable
|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||