public abstract class AddressDivisionBase extends Object implements AddressGenericDivision
Modifier and Type | Field and Description |
---|---|
static char[] |
EXTENDED_DIGITS |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Two divisions are equal if they:
- they match type/version (ipv4, ipv6, mac, or a specific division class)
- match bit counts
- match values
Prefix lengths, for those divisions that have them, are ignored.
|
byte[] |
getBytes()
Gets the bytes for the lowest address in the range represented by this address division.
|
byte[] |
getBytes(byte[] bytes)
Equivalent to
getBytes(byte[], int) with index of 0. |
byte[] |
getBytes(byte[] bytes,
int index)
Gets the value for the lowest address in the range represented by this address division.
|
static int |
getDigitCount(BigInteger val,
BigInteger radix) |
static int |
getDigitCount(long value,
int radix) |
int |
getLowerStandardString(int segmentIndex,
AddressSegmentParams params,
StringBuilder appendable)
Configures a segment string according to the given params and the given segment index, but using only the lower value of the segment range,
if there is a range.
|
int |
getStandardString(int segmentIndex,
AddressSegmentParams params,
StringBuilder appendable)
Produces a string to represent the segment, using wildcards and range characters.
|
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.
|
byte[] |
getUpperBytes(byte[] bytes,
int index)
Copies the bytes of the largest address item represented by this address item into the supplied array at the given index,
and returns that array.
|
int |
hashCode() |
String |
toString() |
getDigitCount, getMaxDigitCount, isBoundedBy
compareTo, containsPrefixBlock, containsSinglePrefixBlock, getBitCount, getBitsForCount, getBlockSize, getByteCount, getCount, getMinPrefixLengthForBlock, getPrefixCount, getPrefixLengthForSingleBlock, getUpperValue, getValue, includesMax, includesZero, isFullRange, isMax, isMultiple, isZero
public boolean equals(Object o)
public byte[] getBytes()
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[] getBytes(byte[] bytes, int index)
If the value fits in the specified array at the specified index, the same array is returned with the value copied at the specified index. Otherwise, a new array is allocated and returned with the value copied at the specified index, and the rest of the array contents the same as the original.
You can use 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[] getBytes(byte[] bytes)
getBytes(byte[], int)
with index of 0.getBytes
in interface AddressItem
public byte[] getUpperBytes()
getUpperBytes
in interface AddressItem
public byte[] getUpperBytes(byte[] bytes, int index)
AddressItem
getUpperBytes
in interface AddressItem
public byte[] getUpperBytes(byte[] bytes)
AddressItem
getUpperBytes
in interface AddressItem
public static int getDigitCount(BigInteger val, BigInteger radix)
public static int getDigitCount(long value, int radix)
public int getLowerStandardString(int segmentIndex, AddressSegmentParams params, StringBuilder appendable)
AddressStringDivision
If appendable is null, simply returns the length of the string that would have been appended.
getLowerStandardString
in interface AddressStringDivision
public int getStandardString(int segmentIndex, AddressSegmentParams params, StringBuilder appendable)
getStandardString
in interface AddressStringDivision