java.lang.Object
com.voytechs.jnetstream.primitive.address.Address
com.voytechs.jnetstream.primitive.address.IpNetmask
- public class IpNetmask
- extends Address
- Version:
- $Revision: 1.1.1.1 $
| Methods inherited from class com.voytechs.jnetstream.primitive.address.Address |
AND, AND, byteArrayValue, compare, compare, compareTo, EOR, EOR, equals, getByte, getByte, getRadix, INVERT, INVERT, longToByteArray, OR, OR, parseByteArray, setAddress, setByteArrayAddress, setFormat, setFormat, setRadix, setSeparator, stringValue, toByteArray, toString, toString |
bitsInMask
private int bitsInMask
IpNetmask
public IpNetmask(java.lang.String netmask)
IpNetmask
public IpNetmask(int bitsInMask)
parseBitCount
public static byte[] parseBitCount(int bits)
- Converts into a long for a IP V4 netmask. Throws
an exception if bit count is greater than 32.
This is only a V4 convention.
getBitsInNetmask
public int getBitsInNetmask()
- Return the number of bits turn on in a netmask. This is use full
if you want to display the netmask as a slash with number of bits in mask.
applyNetmask
public byte[] applyNetmask(Address ip)
- This method applies the netmask to another IpNumber object
such as IpAddress or IpNetwork. Netmask is ANDed with every byte
in the corresponding object. If number of bytes in the netmask
does not match the number in the IpNumber object then an IllegalArgumentException
is thrown.
applyNetmask
public byte[] applyNetmask(byte[] ip)
countBits
private static int countBits(byte[] byteArray)
toString
public java.lang.String toString()
- Description copied from class:
Address
- Convert to dot notation string representation of the address
- Overrides:
toString in class Address
main
public static void main(java.lang.String[] args)
- Test function for IpNetmask