public abstract class AddressDivisionBase extends java.lang.Object implements AddressItem, AddressStringDivision
Modifier and Type | Method and Description |
---|---|
byte[] |
getBytes()
Gets the bytes for the lowest address in the range represented by this address division.
|
byte[] |
getBytes(byte[] bytes)
Gets the value for the lowest address in the range represented by this address division.
|
int |
getConfiguredString(int segmentIndex,
AddressSegmentParams params,
java.lang.StringBuilder appendable)
Configures a segment string according to the given params and the given segment index.
|
abstract int |
getDefaultTextualRadix() |
static int |
getDigitCount(long value,
int radix) |
abstract int |
getMaxDigitCount() |
int |
getPrefixAdjustedString(int segmentIndex,
AddressSegmentParams params,
java.lang.StringBuilder appendable)
Produces a string to represent the segment.
|
int |
getStandardString(int segmentIndex,
AddressSegmentParams params,
java.lang.StringBuilder appendable)
Produces a string to represent the segment, favouring wildcards and range characters over the network prefix to represent subnets.
|
java.lang.String |
getString()
Produces a normalized string to represent the segment.
|
byte[] |
getUpperBytes() |
byte[] |
getUpperBytes(byte[] bytes)
Copies the bytes of the largest address item represented by this address item into the supplied array,
and returns that array.
|
java.lang.String |
toString() |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getBitCount, getCount, isFullRange, isMultiple, isZero
getDigitCount, getMaxDigitCount, isBoundedBy
public byte[] getBytes()
getBytes
in interface AddressItem
public byte[] getBytes(byte[] bytes)
AddressItem.getBitCount()
to determine the required array length for the bytes.
Since bytes are signed values while addresses are unsigned, values greater than 127 are
represented as the (negative) two's complement value of the actual value.
You can get the unsigned integer value i from byte b using i = 0xff & b.getBytes
in interface AddressItem
public byte[] getUpperBytes()
getUpperBytes
in interface AddressItem
public byte[] getUpperBytes(byte[] bytes)
AddressItem
getUpperBytes
in interface AddressItem
public abstract int getDefaultTextualRadix()
public abstract int getMaxDigitCount()
public static int getDigitCount(long value, int radix)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getString()
public int getPrefixAdjustedString(int segmentIndex, AddressSegmentParams params, java.lang.StringBuilder appendable)
Use this instead of #getString(Wildcards, int, String, int, boolean, boolean, char, boolean, StringBuilder)
if you wish to avoid printing wildcards in the host section of the address.
Instead, this method will rely on the prefix length instead.
Use this instead of getString() if you have a customized wildcard or range separator or you have a non-zero leadingZeroCount, or you have a string prefix, or you have a non-default radix (for IPv4 default radix is 10, for IPv6 it is 16)
public int getConfiguredString(int segmentIndex, AddressSegmentParams params, java.lang.StringBuilder appendable)
AddressStringDivision
getConfiguredString
in interface AddressStringDivision
public int getStandardString(int segmentIndex, AddressSegmentParams params, java.lang.StringBuilder appendable)