|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.at4j.support.lang.UnsignedByte
public final class UnsignedByte
This object represents an unsigned byte (eight bits) with a value between
0
and 255
(inclusive). It is immutable.
Unsigned byte instances are created by calling any of the static valueOf
methods on this class.
UnsignedShort
,
UnsignedInteger
,
UnsignedLong
,
Serialized FormField Summary | |
---|---|
static short |
MAX_VALUE
The maximum value of an unsigned byte (255). |
static short |
MIN_VALUE
The minimum value of an unsigned byte (0). |
static UnsignedByte |
ONE
The value 1. |
static UnsignedByte |
ZERO
The value 0. |
Method Summary | |
---|---|
byte |
byteValue()
Get the unsigned byte value as a signed byte value between -128
and 127 (inclusive). |
int |
compareTo(UnsignedByte b2)
|
boolean |
equals(Object o)
|
int |
hashCode()
|
int |
intValue()
Get the unsigned byte value as an int . |
boolean |
isBitSet(int no)
Is the specified bit set in the byte value? |
static UnsignedByte |
read(InputStream is)
Read an unsigned byte value from the supplied InputStream . |
static UnsignedByte |
read(RandomAccess ra)
Read an unsigned byte value from the supplied RandomAccess . |
short |
shortValue()
Get the unsigned byte value as a short . |
String |
toString()
|
static UnsignedByte |
valueOf(byte value)
Create an unsigned byte value from the supplied byte value. |
static UnsignedByte |
valueOf(int value)
Create a new unsigned byte value from the supplied int value
which must be in the range 0 to 255 (inclusive). |
static UnsignedByte |
valueOf(short value)
Create a new unsigned byte value from the supplied short value
which must be in the range 0 to 255 (inclusive). |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final short MAX_VALUE
public static final short MIN_VALUE
public static final UnsignedByte ZERO
public static final UnsignedByte ONE
Method Detail |
---|
public static UnsignedByte valueOf(byte value)
value
- The value.
valueOf(short)
,
valueOf(int)
public static UnsignedByte valueOf(short value) throws IllegalArgumentException
short
value
which must be in the range 0
to 255
(inclusive).
value
- The value.
IllegalArgumentException
- If the supplied value is not in the
permitted range.public static UnsignedByte valueOf(int value) throws IllegalArgumentException
int
value
which must be in the range 0
to 255
(inclusive).
value
- The value.
IllegalArgumentException
- If the supplied value is not in the
permitted range.public int intValue()
int
.
public short shortValue()
short
.
public byte byteValue()
-128
and 127
(inclusive).
public boolean isBitSet(int no) throws IllegalArgumentException
no
- The index number of the bit. Bit 0 is the bit representing the
value 1, bit 7 is the bit representing the value 128.
true
if the specified bit is set.
IllegalArgumentException
- If no
is not in the range
0 <= no <= 7
(inclusive).public static UnsignedByte read(RandomAccess ra) throws UnexpectedEofException, WrappedIOException
RandomAccess
. The
file pointer is advanced one position by this method.
ra
- The RandomAccess
object to read from.
UnexpectedEofException
- If the file pointer is at the end of the
file.
WrappedIOException
- On I/O errors.public static UnsignedByte read(InputStream is) throws UnexpectedEofException, WrappedIOException
InputStream
.
is
- The stream to read from.
UnexpectedEofException
- If no more data could be read from the
stream.
WrappedIOException
- On I/O errors.public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public int compareTo(UnsignedByte b2)
compareTo
in interface Comparable<UnsignedByte>
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |