|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.at4j.support.lang.UnsignedLong
public final class UnsignedLong
This object represents an unsigned long (eight bytes or 64 bits) with a value
between {code 0} and 18446744073709551615. It is immutable.
Unsigned longs are created by calling any of the static creation methods of this class.
SignedLong,
UnsignedByte,
UnsignedShort,
UnsignedInteger,
Serialized Form| Field Summary | |
|---|---|
static BigInteger |
MAX_VALUE
The maximum allowed value (18446744073709551615). |
static BigInteger |
MIN_VALUE
The minimum allowed value (0). |
static UnsignedLong |
ONE
The value one. |
static UnsignedLong |
ZERO
The value zero. |
| Method Summary | |
|---|---|
BigInteger |
bigIntValue()
Get the unsigned long value as a BigInteger. |
int |
compareTo(UnsignedLong l2)
|
boolean |
equals(Object o)
|
static UnsignedLong |
fromBigEndianByteArray(byte[] barr)
Create an unsigned long value from a eight bytes long, big-endian byte array. |
static UnsignedLong |
fromBigEndianByteArray(byte[] barr,
int offset)
Create an unsigned long value from eight bytes read from the given offset position in the supplied byte array. |
byte[] |
getBigEndianByteArray()
Get the unsigned long value as a big-endian, eight bytes long byte array. |
int |
hashCode()
|
long |
longValue()
Return the value as a signed long. |
static UnsignedLong |
readBigEndian(InputStream is)
Create an unsigned long value from eight bytes read from the stream. |
static UnsignedLong |
readBigEndian(RandomAccess ra)
Create an unsigned long value from eight bytes read starting from the current position in the supplied RandomAccess. |
String |
toString()
|
static UnsignedLong |
valueOf(BigInteger value)
Create an unsigned long value from the supplied BigInteger value
which must be in the range 0 to 18446744073709551615
(inclusive) |
static UnsignedLong |
valueOf(long value)
Create an unsigned long. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final BigInteger MIN_VALUE
public static final BigInteger MAX_VALUE
public static final UnsignedLong ZERO
public static final UnsignedLong ONE
| Method Detail |
|---|
public static UnsignedLong valueOf(long value)
9223372036854775808 and 18446744073709551615 (inclusive).
value - The value.
public static UnsignedLong valueOf(BigInteger value)
throws IllegalArgumentException
BigInteger value
which must be in the range 0 to 18446744073709551615
(inclusive)
value - The value.
IllegalArgumentException - If the supplied value is negative or if
it is greater than MAX_VALUE.public BigInteger bigIntValue()
BigInteger.
BigInteger.public long longValue()
Long.MAX_VALUE, it is returned as a positive long. If not, it is
returned as a negative long.
public byte[] getBigEndianByteArray()
public static UnsignedLong fromBigEndianByteArray(byte[] barr)
throws IllegalArgumentException
barr - The byte array. It must be eight bytes long.
IllegalArgumentException - If the supplied byte array is not eight
bytes long.fromBigEndianByteArray(byte[], int)
public static UnsignedLong fromBigEndianByteArray(byte[] barr,
int offset)
throws ArrayIndexOutOfBoundsException
barr - The byte array to read from.offset - The offset in the byte array where the least significant
(first) byte is.
ArrayIndexOutOfBoundsException - If the supplied array is too short
or if the offset is negative.fromBigEndianByteArray(byte[])
public static UnsignedLong readBigEndian(RandomAccess ra)
throws UnexpectedEofException,
WrappedIOException
RandomAccess. The most
significant byte is the last byte read.
ra - The RandomAccess to read from. The current position is
advanced eight positions by this method.
UnexpectedEofException - If the end of the file is reached before
eight bytes have been read.
WrappedIOException - On I/O errors.
public static UnsignedLong readBigEndian(InputStream is)
throws UnexpectedEofException,
WrappedIOException
is - The stream to read from.
UnexpectedEofException - If the end of the stream is reached before
eight bytes have been read.
WrappedIOException - On I/O errors.public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic int compareTo(UnsignedLong l2)
compareTo in interface Comparable<UnsignedLong>public String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||