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(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()
Returns a hash code value for the object.
|
String |
toString()
Returns a string representation of the object.
|
getDigitCount, getMaxDigitCount, isBoundedBycompareTo, containsPrefixBlock, containsSinglePrefixBlock, getBitCount, getByteCount, getCount, getMinPrefixLengthForBlock, getPrefixCount, getPrefixLengthForSingleBlock, getUpperValue, getValue, includesMax, includesZero, isFullRange, isMax, isMultiple, isZeropublic boolean equals(Object o)
equals in class Objecto - the reference object with which to compare.true if this object is the same as the obj
argument; false otherwise.Object.hashCode(),
HashMappublic int hashCode()
java.lang.ObjectHashMap.
The general contract of hashCode is:
hashCode method
must consistently return the same integer, provided no information
used in equals comparisons on the object is modified.
This integer need not remain consistent from one execution of an
application to another execution of the same application.
equals(Object)
method, then calling the hashCode method on each of
the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hash tables.
As much as is reasonably practical, the hashCode method defined by
class Object does return distinct integers for distinct
objects. (This is typically implemented by converting the internal
address of the object into an integer, but this implementation
technique is not required by the
Java™ programming language.)
hashCode in class ObjectObject.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)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 AddressItempublic 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 AddressItempublic byte[] getBytes(byte[] bytes)
getBytes(byte[], int) with index of 0.getBytes in interface AddressItempublic byte[] getUpperBytes()
getUpperBytes in interface AddressItempublic byte[] getUpperBytes(byte[] bytes,
int index)
AddressItemgetUpperBytes in interface AddressItempublic byte[] getUpperBytes(byte[] bytes)
AddressItemgetUpperBytes in interface AddressItempublic static int getDigitCount(long value,
int radix)
public String toString()
java.lang.ObjecttoString method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
public int getLowerStandardString(int segmentIndex,
AddressSegmentParams params,
StringBuilder appendable)
AddressStringDivisionIf appendable is null, simply returns the length of the string that would have been appended.
getLowerStandardString in interface AddressStringDivisionpublic int getStandardString(int segmentIndex,
AddressSegmentParams params,
StringBuilder appendable)
getStandardString in interface AddressStringDivision