|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectverinec.netsim.addresses.IPAddress
public class IPAddress
This class is an IPAddress that uses internally a four byte representation. e.g. 192.168.0.1
| Field Summary | |
|---|---|
private byte[] |
address
|
| Constructor Summary | |
|---|---|
IPAddress()
Constructs a new IPAddress with the value 0.0.0.0 |
|
IPAddress(byte i0,
byte i1,
byte i2,
byte i3)
Constructs a new IPAddress with the value i0.i1.i2.i3 |
|
IPAddress(Inet4Address address)
Constructs a new IPAddress from a java Inet4Address |
|
IPAddress(String address)
Constructs a new IPAddress form a String. |
|
| Method Summary | |
|---|---|
int |
compareTo(IPAddress address,
int part)
compares a part of an ip address. |
int |
compareTo(Object arg0)
|
int |
compareToDigitByDigit(IPAddress arg0)
|
private int |
compareToPart(IPAddress address,
int part)
Starts comparing recursively this Address with address from the part'th byte on. |
boolean |
equals(IAddress address)
Tests if an address is equal to this address. |
private char |
getAddressClass()
gets the subnet class of the address (a, b, c, d or e) |
byte |
getPart(int i)
gets the i'th byte of this Address. |
IPAddress |
getsubnetMask()
gets the default subnet mask for this address. |
protected void |
setPart(int i,
byte a)
Sets the i'th byte of the Address to the value a. |
byte[] |
toByteArray()
returns the array of the 4 bytes of this address |
InetAddress |
toInetAddress()
returns a InetAddress coressponding this Address |
String |
toString()
get the IPAddress in the dotted string representation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private byte[] address
| Constructor Detail |
|---|
public IPAddress()
public IPAddress(byte i0,
byte i1,
byte i2,
byte i3)
i0 - first byte of the Addressi1 - second byte of the Addressi2 - third byte of the Addressi3 - fourth byte of the Addresspublic IPAddress(Inet4Address address)
address - a java Inet4Addresspublic IPAddress(String address)
address - in String representation with "."s between the four bytes. e.g
"127.0.0.1"| Method Detail |
|---|
public int compareTo(IPAddress address,
int part)
address - an address to comparepart - part to be compared
public int compareTo(Object arg0)
compareTo in interface ComparableComparable.compareTo(java.lang.Object)public int compareToDigitByDigit(IPAddress arg0)
private int compareToPart(IPAddress address,
int part)
address - an address to comparepart - starts comparing at this part
value
public boolean equals(IAddress address)
IAddress
equals in interface IAddressaddress - an address to compare with this Address
IAddress.equals(verinec.netsim.addresses.IAddress)private char getAddressClass()
public byte getPart(int i)
i - the byte that should be returned
public IPAddress getsubnetMask()
protected void setPart(int i,
byte a)
i - the byte that sould be changeda - the i'th byte valuepublic String toString()
192.168.0.1
toString in interface IAddresstoString in class ObjectIAddress.toString()
public InetAddress toInetAddress()
throws UnknownHostException
UnknownHostException - if the InetAddress can't be buildpublic byte[] toByteArray()
|
Copyright © 2005 Verinec, DIUF | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||