public class Prefix extends Object implements Comparable<Prefix>, Comparator<Prefix>
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
base |
protected byte[] |
broadcast |
protected byte[] |
mask |
protected int |
maskLength |
| Modifier | Constructor and Description |
|---|---|
protected |
Prefix() |
|
Prefix(byte[] addr,
int maskLength) |
|
Prefix(InetAddress addr,
int maskLength) |
| Modifier and Type | Method and Description |
|---|---|
int |
compare(Prefix p1,
Prefix p2) |
int |
compareTo(Prefix other) |
boolean |
equals(Object o) |
boolean |
equals(Prefix other) |
InetAddress |
getBaseAddress() |
InetAddress |
getBroadcastAddress() |
int |
getMaskLength() |
boolean |
includes(Prefix other) |
boolean |
isDefault() |
boolean |
isIncludedBy(Prefix other) |
boolean |
isIPv4() |
boolean |
isIPv6() |
protected boolean |
matches(byte[] addr) |
boolean |
matches(InetAddress addr) |
static Prefix |
parseString(String s) |
void |
setMaskLength(int maskLength) |
protected void |
setPrefix(byte[] addr,
int maskLen) |
String |
toString() |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcomparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongprotected byte[] base
protected byte[] mask
protected byte[] broadcast
protected int maskLength
protected Prefix()
public Prefix(InetAddress addr, int maskLength) throws PrefixMaskException
PrefixMaskExceptionpublic Prefix(byte[] addr,
int maskLength)
throws PrefixMaskException
PrefixMaskExceptionpublic static Prefix parseString(String s) throws NumberFormatException, UnknownHostException, PrefixMaskException
protected void setPrefix(byte[] addr,
int maskLen)
throws PrefixMaskException
PrefixMaskExceptionpublic InetAddress getBaseAddress()
public InetAddress getBroadcastAddress()
public int getMaskLength()
public void setMaskLength(int maskLength)
throws PrefixMaskException,
UnknownHostException
public boolean matches(InetAddress addr)
protected boolean matches(byte[] addr)
public boolean includes(Prefix other)
public boolean isIncludedBy(Prefix other)
public boolean isIPv4()
public boolean isIPv6()
public int compare(Prefix p1, Prefix p2)
compare in interface Comparator<Prefix>public int compareTo(Prefix other)
compareTo in interface Comparable<Prefix>public boolean equals(Prefix other)
public boolean equals(Object o)
equals in interface Comparator<Prefix>equals in class Objectpublic boolean isDefault()
Copyright © 2025. All rights reserved.