com.limegroup.gnutella.messages
Class QueryReply.IPPortCombo
java.lang.Object
com.limegroup.gnutella.messages.QueryReply.IPPortCombo
- Enclosing class:
- QueryReply
- public static class QueryReply.IPPortCombo
- extends java.lang.Object
Another utility class the encapsulates some complexity.
Keep in mind that I very well could have used Endpoint here, but I
decided against it mainly so I could do validity checking.
This may be a bad decision. I'm sure someone will let me know during
code review.
Field Summary |
static java.lang.String |
DELIM
|
Constructor Summary |
QueryReply.IPPortCombo(java.lang.String hostAddress,
int port)
Constructor used for local data. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
DELIM
public static final java.lang.String DELIM
- See Also:
- Constant Field Values
QueryReply.IPPortCombo
public QueryReply.IPPortCombo(java.lang.String hostAddress,
int port)
throws java.net.UnknownHostException,
java.lang.IllegalArgumentException
- Constructor used for local data.
Throws IllegalArgumentException on errors.
getCombo
public static QueryReply.IPPortCombo getCombo(byte[] fromNetwork)
throws BadPacketException
- Used for reading data from the network. Throws BadPacketException
if the data is invalid.
- Parameters:
fromNetwork
- 6 bytes - first 4 are IP, next 2 are port
- Throws:
BadPacketException
getPort
public int getPort()
getAddress
public java.net.InetAddress getAddress()
toBytes
public byte[] toBytes()
- Returns:
- the ip and port encoded in 6 bytes (4 ip, 2 port).
//TODO if IPv6 kicks in, this may fail, don't worry so much now.
equals
public boolean equals(java.lang.Object other)
hashCode
public int hashCode()