|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.foxsmart.ic.net.IpAddress
public class IpAddress
The IpAddress class represents an individual network IP address. The IP Address has the form of A.B.C.D (e.g. 255.255.255.0) and contains 4 parts. Each part of the IP Address is a digit that ranges from 0-255.
| Constructor Summary | |
|---|---|
IpAddress(java.net.InetAddress inetAddress)
Constructs an IP Address based on an InetAddress format. |
|
IpAddress(int a,
int b,
int c,
int d)
Constructs an IP Address based on the individual pieces. |
|
IpAddress(java.lang.String ipAddress)
Constructs an IP Address object based on a string representation of one. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object ipAddressObject)
Determines if 2 IP Address objects are equal. |
int |
getA()
Gets the "A" portion of the IP Address. |
int |
getB()
Gets the "B" portion of the IP Address. |
int |
getC()
Gets the "C" portion of the IP Address. |
int |
getD()
Gets the "D" portion of the IP Address. |
static IpAddress |
getLocalHostAddress()
Returns the IP Address of the localhost. |
static void |
main(java.lang.String[] args)
Test driver. |
java.lang.String |
toString()
Returns the string representation of the IP Address. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IpAddress(int a,
int b,
int c,
int d)
throws java.lang.IllegalArgumentException
a - The A part of the IP Addressb - The B part of the IP Addressc - The C part of the IP Addressd - The D part of the IP Address
java.lang.IllegalArgumentException - if the piece is out of range.
public IpAddress(java.lang.String ipAddress)
throws java.lang.IllegalArgumentException
ipAddress - The IP Address in the form of A.B.C.D as a string.
java.lang.IllegalArgumentException - if the format is invalid.public IpAddress(java.net.InetAddress inetAddress)
inetAddress - The IP Address
java.lang.IllegalArgumentException - if the format is invalid.| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object ipAddressObject)
equals in class java.lang.ObjectipAddressObject - The IP Address to compare.
public int getA()
public int getB()
public int getC()
public int getD()
public static IpAddress getLocalHostAddress()
throws java.net.UnknownHostException
java.net.UnknownHostException - if the IP Address of the localhost could not be determined.public static void main(java.lang.String[] args)
args - The arguments.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||