org.n52.security.common.ip
Class IP4AddressMask.IP4Mask

java.lang.Object
  extended by org.n52.security.common.ip.IP4AddressMask.IP4Mask
Enclosing class:
IP4AddressMask

public static class IP4AddressMask.IP4Mask
extends Object


Constructor Summary
IP4AddressMask.IP4Mask(int prefixLength)
          Creates a subnet mask defined by a subnet mask prefix.
 
Method Summary
 String asBitString()
          Creates a bit string representation of the mask, which is a String of '1' and '0' characters.
 byte[] asByteArray()
          Returns a byte[] representation of the mask.
 boolean equals(Object obj)
           
 int getPrefixLength()
           
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IP4AddressMask.IP4Mask

public IP4AddressMask.IP4Mask(int prefixLength)
Creates a subnet mask defined by a subnet mask prefix. The prefix length defines the number of bits that make the prefix, e.g. the prefix length 4 results in a subnet mask represented by the bit string 11110000.00000000.00000000.00000000

Parameters:
prefixLength - the prefix length.
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

asBitString

public String asBitString()
Creates a bit string representation of the mask, which is a String of '1' and '0' characters.

Returns:
the String representation.

asByteArray

public byte[] asByteArray()
Returns a byte[] representation of the mask. The first element of the array represents the highest value of the mask, e.g. for 10.0.0.0 the element at index 0 has the value '10'.

Returns:
the mask as a byte array.

getPrefixLength

public int getPrefixLength()


Copyright © 2004–2014 52north.org. All rights reserved.