com.esf.util.net.service
Class IpAddress

java.lang.Object
  extended by com.esf.util.net.service.IpAddress

public class IpAddress
extends java.lang.Object

Container for an IP address value.


Field Summary
 int b0
          First octet of IP address
 int b1
          Second octet of IP address
 int b2
          Third octet of IP address
 int b3
          Fourth octet of IP address
 
Constructor Summary
IpAddress()
          Default constructor, sets IP to 0.0.0.0
IpAddress(java.lang.String ipAddressAsString)
          Convert IP as String in dotted notation, to an IpAddress object
 
Method Summary
 int asInteger()
          Returns value of IP address as integer.
 void maskByInvertedSubnet(IpAddress subnet)
          Masks the IpAddress by the inversion of subnet, to obtain a numeric IP broadcast address.
 void maskBySubnet(IpAddress subnet)
          Masks the IpAddress by the specified subnet, to obtain a numeric IP network identifier.
 java.lang.String toString()
          Returns IP address in dotted notation
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

b0

public int b0
First octet of IP address


b1

public int b1
Second octet of IP address


b2

public int b2
Third octet of IP address


b3

public int b3
Fourth octet of IP address

Constructor Detail

IpAddress

public IpAddress()
Default constructor, sets IP to 0.0.0.0


IpAddress

public IpAddress(java.lang.String ipAddressAsString)
Convert IP as String in dotted notation, to an IpAddress object

Parameters:
ipAddressAsString - IP in dotted notation
Method Detail

asInteger

public int asInteger()
Returns value of IP address as integer. Most significant byte is the first octet, etc.

Returns:
IP address converted to 32-bit integer

maskBySubnet

public void maskBySubnet(IpAddress subnet)
Masks the IpAddress by the specified subnet, to obtain a numeric IP network identifier.

Parameters:
subnet - as IpAddress type

maskByInvertedSubnet

public void maskByInvertedSubnet(IpAddress subnet)
Masks the IpAddress by the inversion of subnet, to obtain a numeric IP broadcast address.

Parameters:
subnet - as IpAddress type

toString

public java.lang.String toString()
Returns IP address in dotted notation

Overrides:
toString in class java.lang.Object
Returns:
IP as String