public final class BigPortNumber extends U32Id implements Comparable<BigPortNumber>
All constructors for this class are private.
Creating instances of BigPortNumber is done via the static
methods on the class.
Instances of this class are immutable, making them inherently threadsafe.
This class overrides UnsignedLongBasedId.equals(java.lang.Object) and UnsignedLongBasedId.hashCode() so that
instances play nicely with the Collection classes.
This class implements the Comparable interface to ensure that
a sorted list of port numbers is presented in an intuitive order.
PortNumber,
Serialized FormE_BYTES_BAD_LEN, LENGTH_IN_BYTES, MAX_VALUEidE_BAD, E_NULL_BYTES, E_NULL_STR, E_OOR, MIN_VALUE| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(BigPortNumber o)
Implements the Comparable interface, to return port numbers in
natural order.
|
static BigPortNumber |
valueFrom(ByteBuffer buffer)
Reads 4 bytes from the specified byte buffer and creates a port number
entity from their value.
|
static BigPortNumber |
valueOf(byte[] bytes)
Returns an object that represents the port number
defined by the specified byte array.
|
static BigPortNumber |
valueOf(long port)
Returns an object that represents the big port number
defined by the specified long.
|
static BigPortNumber |
valueOf(String portStr)
Returns an object that represents the big port number
defined by the specified string.
|
rangeCheck, toByteArrayequals, hashCode, toLong, toStringparseIntStr, parseLongStrgetRefQ, keyFromBytespublic int compareTo(BigPortNumber o)
compareTo in interface Comparable<BigPortNumber>o - the other port numberComparable.compareTo(T)public static BigPortNumber valueOf(long port)
port - the port numberIllegalArgumentException - if the port number is invalidpublic static BigPortNumber valueOf(String portStr)
portStr - the port number as a stringIllegalArgumentException - if the string is invalidNullPointerException - if the string is nullpublic static BigPortNumber valueOf(byte[] bytes)
U32Id.LENGTH_IN_BYTES bytes long.bytes - the encoded idNullPointerException - if the byte array is nullIllegalArgumentException - if the byte array is not 4 bytes longpublic static BigPortNumber valueFrom(ByteBuffer buffer)
buffer - byte buffer to get bytes fromBufferUnderflowException - the buffer does not have sufficient
number of bytes remainingCopyright © 2014. All Rights Reserved.