public final class UnsignedByte extends Object implements Serializable, Comparable<UnsignedByte>
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 FormModifier and Type | Field and Description |
---|---|
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.
|
Modifier and Type | Method and Description |
---|---|
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(org.entityfs.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). |
public static final short MAX_VALUE
public static final short MIN_VALUE
public static final UnsignedByte ZERO
public static final UnsignedByte ONE
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(org.entityfs.RandomAccess ra) throws org.entityfs.exception.UnexpectedEofException, org.entityfs.support.exception.WrappedIOException
RandomAccess
. The
file pointer is advanced one position by this method.ra
- The RandomAccess
object to read from.org.entityfs.exception.UnexpectedEofException
- If the file pointer is at the end of the
file.org.entityfs.support.exception.WrappedIOException
- On I/O errors.public static UnsignedByte read(InputStream is) throws org.entityfs.exception.UnexpectedEofException, org.entityfs.support.exception.WrappedIOException
InputStream
.is
- The stream to read from.org.entityfs.exception.UnexpectedEofException
- If no more data could be read from the
stream.org.entityfs.support.exception.WrappedIOException
- On I/O errors.public int compareTo(UnsignedByte b2)
compareTo
in interface Comparable<UnsignedByte>