public class Ipv4Interval extends IpInterval<Ipv4Interval> implements Comparable<Ipv4Interval>
ints. Externally they are
represented as longs to avoid issues with the sign-bit.| Modifier and Type | Field and Description |
|---|---|
static String |
IPV4_DOTLESS_REVERSE_DOMAIN |
static String |
IPV4_REVERSE_DOMAIN |
static Ipv4Interval |
MAX_RANGE
The IPv4 interval that includes all IPv4 addresses (0.0.0.0/0 in CIDR
notation).
|
| Constructor and Description |
|---|
Ipv4Interval(long begin,
long end)
Constructs a new IPv4 interval with the specified begin and end (both
inclusive).
|
asIpInterval, valueOfpublic static final String IPV4_DOTLESS_REVERSE_DOMAIN
public static final String IPV4_REVERSE_DOMAIN
public static final Ipv4Interval MAX_RANGE
public Ipv4Interval(long begin,
long end)
begin - the first IPv4 address in this address range (inclusive).end - the last IPv4 address in this address range (inclusive).IllegalArgumentException - if the start or end addresses are invalid or if the start
address is greater than the end address.public static Ipv4Interval parse(InetAddress inetAddress)
public static Ipv4Interval parse(String resource)
public static Ipv4Interval parseIpAddress(String ipAddress)
public static Ipv4Interval parsePrefixWithLength(long prefix, int prefixLength)
public static Ipv4Interval parseReverseDomain(String address)
public long begin()
long.public long end()
long.public boolean contains(Ipv4Interval that)
Intervalthat. Note that if two
intervals are equal, they also contain each other (and vice
versa). An interval always contains itself.contains in interface Interval<Ipv4Interval>that - the interval to test for containmentthis contains that intervalpublic boolean intersects(Ipv4Interval that)
Intervalintersects in interface Interval<Ipv4Interval>that - the other interval to test for intersectionthis interval intersects that
intervalpublic static String numericToTextFormat(int src)
public static int textToNumericFormat(String src)
public String toRangeString()
toRangeString in class IpInterval<Ipv4Interval>public String toPrefixString()
toPrefixString in class IpInterval<Ipv4Interval>public String toReverseDomain()
toReverseDomain in class IpInterval<Ipv4Interval>public String beginAddressAsString()
beginAddressAsString in class IpInterval<Ipv4Interval>public String endAddressAsString()
endAddressAsString in class IpInterval<Ipv4Interval>public int compareTo(Ipv4Interval that)
begin ASCENDING and end DESCENDING. This puts
less-specific ranges before more-specific ranges.compareTo in interface Comparable<Ipv4Interval>public Ipv4Interval singletonIntervalAtLowerBound()
IntervalInterval a = ... Interval b = ... if (a.singletonIntervalAtLowerBound().compareUpperBoundTo(b) < 0) ...
singletonIntervalAtLowerBound in interface Interval<Ipv4Interval>public int compareUpperBound(Ipv4Interval that)
IntervalNestedIntervalMap implementation to quickly find two potentially
intersecting intervals by ordering intervals on the upper-bound and
searching based on the lower-bound.compareUpperBound in interface Interval<Ipv4Interval>that - the interval to compare the upper-bound withpublic InetAddress beginAsInetAddress()
beginAsInetAddress in class IpInterval<Ipv4Interval>public InetAddress endAsInetAddress()
endAsInetAddress in class IpInterval<Ipv4Interval>public byte[] beginAsByteArray()
beginAsByteArray in class IpInterval<Ipv4Interval>public byte[] endAsByteArray()
endAsByteArray in class IpInterval<Ipv4Interval>public int getPrefixLength()
getPrefixLength in class IpInterval<Ipv4Interval>Copyright © 2022. All rights reserved.