|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--hypercast.INETv4OnePort
This class implements a physical address which works on the TCP/IP networks. It contains a IP version 4 address and a port number.
Field Summary | |
static int |
ADDRESS_SIZE
The size of INETv4OnePort type physical address when carried in the packet. |
static int |
INETv4_ADDRESS_SIZE
The size of IP address when carried in the packet. |
static int |
MAX_PORT
|
static int |
MIN_PORT
|
static int |
PORT_NUMBER_SIZE
The size of port number when carried in the packet. |
Constructor Summary | |
INETv4OnePort(byte[] byteAddressAndPort)
Constructs a INETv4OnePort object from an six byte array. |
|
INETv4OnePort(java.net.DatagramSocket a)
Constructs a INETv4OnePort object with DatagramSocket. |
|
INETv4OnePort(java.net.InetAddress a,
int p)
Constructs a INETv4OnePort object with an InetAddress and port number. |
|
INETv4OnePort(hypercast.INETv4OnePort inetv4oneport)
Constructs a INETv4OnePort object with another INETv4OnePort object. |
|
INETv4OnePort(int portnum)
Constructs the INETv4OnePort object which has the specified
port number. |
|
INETv4OnePort(java.lang.String addrAndPortString)
Constructs a INETv4OnePort object from a string. |
Method Summary | |
boolean |
addressCheck(java.lang.Object obj)
Test if two INETv4OnePort addresses are identical. |
boolean |
equals(java.lang.Object obj)
Test if two INETv4OnePort addresses are identical. |
byte[] |
getByteAddress()
Gets byte address of this object. |
java.net.InetAddress |
getInetAddress()
Gets INETv4 address of this object. |
static 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 INETv4OnePort object. |
int |
getSize()
Returns the byte array size. |
boolean |
greaterThan(hypercast.I_Address addr)
Compares two INETv4OnePort 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 MIN_PORT
public static final int MAX_PORT
public static final int INETv4_ADDRESS_SIZE
public static final int PORT_NUMBER_SIZE
public static final int ADDRESS_SIZE
Constructor Detail |
public INETv4OnePort(hypercast.INETv4OnePort inetv4oneport)
INETv4OnePort
object with another INETv4OnePort object.
inetv4oneport
- An INETv4OnePort object.public INETv4OnePort(java.net.InetAddress a, int p)
INETv4OnePort
object with an InetAddress and port number.
This method is called by the constructor of INETv4TwoPorts.
a
- An InetAddress.p
- port number.public INETv4OnePort(java.net.DatagramSocket a)
INETv4OnePort
object with DatagramSocket.
a
- A DatagramSocketObject.public INETv4OnePort(int portnum)
INETv4OnePort
object which has the specified
port number.
portnum
- a port number.public INETv4OnePort(byte[] byteAddressAndPort)
INETv4OnePort
object from an six byte array.
byteAddressAndPort
- an Internet address and port stored in a byte array
java.lang.IllegalArgumentException
- when p is not in 0 to (2^16)-1public INETv4OnePort(java.lang.String addrAndPortString)
INETv4OnePort
object from a string. The string may contain the address and port
separated by a '/' or ':', or only contain a port number.
addrAndPortString
- a string representing the INETv4 address and port (eg. "128.143.71.50/4747" or
"128.143.71.50:4747" or "4747")
java.lang.IllegalArgumentException
- when port is not in 0 to (2^16)-1
HyperCastWarningRuntimeException
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)
equals
in interface I_Address
equals
in class java.lang.Object
obj
- an object (should be of type INETv4OnePort
.)
java.lang.IllegalArgumentException
- if obj
is not of type INETv4OnePort
.public boolean addressCheck(java.lang.Object obj)
addressCheck
in interface I_PhysicalAddress
obj
- an object (should be of type INETv4OnePort
.)
java.lang.IllegalArgumentException
- if obj
is not of type INETv4OnePort
.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 INETv4OnePort
.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 static java.lang.String getLocalIPbyDNS()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |