|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--edu.virginia.cs.mng.hypercast.IP_Address
This class includes all the functions related to an Internet Address/Port pair. The port is always valid (i.e. in the range 0 to (2^16)-1).
| Field Summary | |
private java.net.InetAddress |
address
|
private static int |
MAX_PORT
|
private static int |
MIN_PORT
|
private int |
port
|
| Constructor Summary | |
IP_Address(byte[] byteAddressAndPort)
Constructs a IP_Address object from an 6 byte array. |
|
IP_Address(byte[] byteAddress,
int p)
Constructs a IP_Address object from a byte array address and a port number. |
|
IP_Address(java.net.DatagramSocket udpSocket)
Constructs the IP_Address object cooresponding to the
java.net.DatagramSocket. |
|
IP_Address(java.net.InetAddress a,
int p)
Constructs a IP_Address object from an InetAddress instance and port number. |
|
IP_Address(IP_Address ipAddr)
Constructs a new IP_Address object from an IP_Address object. |
|
IP_Address(java.lang.String addrAndPortString)
Constructs a IP_Address object from a string containing the address and port
separated by a '/' or ':'. |
|
IP_Address(java.lang.String addrString,
int p)
Constructs a IP_Address object from a string address and a port number. |
|
| Method Summary | |
private static java.net.InetAddress |
createInetAddress(byte[] byteAddress)
Constructs an instance of InetAddress from a byte array. |
boolean |
equals(java.lang.Object obj)
Compares two IP address. |
byte[] |
getByteAddress()
Gets byte address of this object. |
java.net.InetAddress |
getInetAddress()
Gets IP address of this object. |
int |
getPort()
Gets port number of this IP_Address object. |
int |
getSize()
Returns the byte array size |
boolean |
greaterThan(I_Address addr)
Compares two IP address objects. |
int |
hashCode()
Returns a hashcode of this object It is important that the argument is of type Object so that
it can be used in a Hashtable. |
byte[] |
toByteArray()
Converts the Address/Port pair to a 6 bytes array. |
java.lang.String |
toString()
Converts the IP address object to string format "xxx.xxx.xxx.xxx/port" (e.g. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private static final int MIN_PORT
private static final int MAX_PORT
private java.net.InetAddress address
private int port
| Constructor Detail |
public IP_Address(IP_Address ipAddr)
IP_Address object from an IP_Address object.ipAddr - any object of type IP_Addresspublic IP_Address(java.net.DatagramSocket udpSocket)
IP_Address object cooresponding to the
java.net.DatagramSocket.ipAddr - any object of type IP_Address
public IP_Address(java.net.InetAddress a,
int p)
IP_Address object from an InetAddress instance and port number.a - an instance of InetAddressP - a port number
public IP_Address(byte[] byteAddress,
int p)
IP_Address object from a byte array address and a port number.byteAddress[] - an Internet address as a byte arrayp - port numberpublic IP_Address(byte[] byteAddressAndPort)
IP_Address object from an 6 byte array.
This uses 2 more bytes than necessary. This is as Tyler Beam initially implemented it.byteAddress[] - an Internet address and port stored in a byte array
public IP_Address(java.lang.String addrString,
int p)
throws java.net.UnknownHostException
IP_Address object from a string address and a port number.addrString - a string representing the IP address (eg. "128.143.71.50")p - The port.InetAddress.getByName
public IP_Address(java.lang.String addrAndPortString)
throws java.net.UnknownHostException
IP_Address object from a string containing the address and port
separated by a '/' or ':'.addrAndPortString - a string representing the IP address and port (eg. "128.143.71.50/4747")InetAddress.getByName| Method Detail |
private static java.net.InetAddress createInetAddress(byte[] byteAddress)
public java.net.InetAddress getInetAddress()
public byte[] getByteAddress()
InetAddress.getAddress.public int getPort()
public int getSize()
public byte[] toByteArray()
public boolean equals(java.lang.Object obj)
Object so that
it can be used in a Hashtable.obj - an object (should be of type IP_Address.)obj is not of type IP_Address.public boolean greaterThan(I_Address addr)
addr - an object of type I_Addressobj is not of type IP_Address.public java.lang.String toString()
public int hashCode()
Object so that
it can be used in a Hashtable.
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||