|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--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 | |
static int |
ADDRESS_SIZE
The size of IP_Address type physical address when carried in the packet. |
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(int portnum)
Constructs the IP_Address object which has the specified
port number. |
|
IP_Address(hypercast.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 | |
boolean |
addressCheck(java.lang.Object obj)
Test if two IP addresses are identical. |
boolean |
equals(java.lang.Object obj)
Test if two IP addresses are identical. |
byte[] |
getByteAddress()
Gets byte address of this object. |
java.net.InetAddress |
getInetAddress()
Gets IP address of this object. |
java.lang.String |
getLocalIPbyDNS()
Obtain local IP address by a DNS query and return local IP address in String form. |
int |
getPort()
Gets port number of this IP_Address object. |
int |
getSize()
Returns the byte array size |
boolean |
greaterThan(hypercast.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 . |
void |
setPort(int Port)
Sets port number of this IP_Address object. |
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 |
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int ADDRESS_SIZE
Constructor Detail |
public IP_Address(hypercast.IP_Address ipAddr)
IP_Address
object from an IP_Address
object.
ipAddr
- any object of type IP_Address
public IP_Address(java.net.DatagramSocket udpSocket)
IP_Address
object cooresponding to the
java.net.DatagramSocket
.
udpSocket
- any object of type DatagramSocket
public IP_Address(int portnum)
IP_Address
object which has the specified
port number.
portnum
- a port number.public IP_Address(java.net.InetAddress a, int p)
IP_Address
object from an InetAddress
instance and port number.
a
- an instance of InetAddress
p
- a port number
java.lang.IllegalArgumentException
- when p is not in 0 to (2^16)-1public 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 number
java.lang.IllegalArgumentException
- when p is not in 0 to (2^16)-1public 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.
byteAddressAndPort
- an Internet address and port stored in a byte array
java.lang.IllegalArgumentException
- when p is not in 0 to (2^16)-1public IP_Address(java.lang.String addrString, int p)
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.
java.lang.IllegalArgumentException
- when p is not in 0 to (2^16)-1
java.net.UnknownHostException
- thrown by InetAddress.getByName
public IP_Address(java.lang.String addrAndPortString)
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")
java.lang.IllegalArgumentException
- when p is not in 0 to (2^16)-1
java.net.UnknownHostException
- thrown by InetAddress.getByName
Method Detail |
public java.net.InetAddress getInetAddress()
public byte[] getByteAddress()
InetAddress.getAddress
.public int getPort()
public void setPort(int Port)
public int getSize()
getSize
in interface I_Address
public byte[] toByteArray()
toByteArray
in interface I_Address
public boolean equals(java.lang.Object obj)
Object
so that
it can be used in a Hashtable
.
equals
in interface I_Address
equals
in class java.lang.Object
obj
- an object (should be of type IP_Address
.)
java.lang.IllegalArgumentException
- if obj
is not of type IP_Address
.public boolean addressCheck(java.lang.Object obj)
Object
so that
it can be used in a Hashtable
.
addressCheck
in interface I_PhysicalAddress
obj
- an object (should be of type IP_Address
.)
java.lang.IllegalArgumentException
- if obj
is not of type IP_Address
.public boolean greaterThan(hypercast.I_Address addr)
greaterThan
in interface I_Address
addr
- an object of type I_Address
java.lang.IllegalArgumentException
- if obj
is not of type IP_Address
.public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
Object
so that
it can be used in a Hashtable
.
hashCode
in interface I_Address
hashCode
in class java.lang.Object
public java.lang.String getLocalIPbyDNS()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |