public class IPRange extends Object
| Modifier and Type | Field and Description |
|---|---|
private int |
addressLength
Number of bits within
|
private BitSet |
mask
The netmask for the range.
|
private BitSet |
network
The IP network address for the range.
|
| Constructor and Description |
|---|
IPRange(byte[] networkAddress,
int maskSize)
Constructor
|
IPRange(InetAddress networkAddress,
int maskSize)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(byte[] address)
Determines whether the given address is contained in the IP range.
|
boolean |
contains(InetAddress address)
Determines whether the given address is contained in the IP range.
|
static IPRange |
parseCIDRBlock(String cidrBlock)
Parses a CIDR block definition in to an IP range.
|
protected BitSet |
toBitSet(byte[] bytes)
Converts a byte array to a BitSet.
|
private int addressLength
private BitSet network
private BitSet mask
public IPRange(InetAddress networkAddress, int maskSize)
networkAddress - the network address for the rangemaskSize - the number of bits in the netmaskpublic IPRange(byte[] networkAddress,
int maskSize)
networkAddress - the network address for the rangemaskSize - the number of bits in the netmaskpublic static IPRange parseCIDRBlock(String cidrBlock)
cidrBlock - the CIDR block definitionpublic boolean contains(InetAddress address)
address - the address to checkpublic boolean contains(byte[] address)
address - the address to checkprotected BitSet toBitSet(byte[] bytes)
bytes - the byte array with most significant bit in element 0.Copyright © 1999-2014. All Rights Reserved.