Class UByte
java.lang.Object
java.lang.Number
org.joou.UNumber
org.joou.UByte
- All Implemented Interfaces:
Serializable, Comparable<UByte>
The
unsigned byte type- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final UByteA constant holding the maximum value anunsigned bytecan have as UByte, 28-1.static final shortA constant holding the maximum value anunsigned bytecan have, 28-1.static final UByteA constant holding the minimum value anunsigned bytecan have as UByte, 0.static final shortA constant holding the minimum value anunsigned bytecan have, 0.private static final longGenerated UIDprivate final shortThe value modelling the content of thisunsigned byteprivate static final UByte[]Cached values -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(int val) intdoublebooleanfloatinthashCode()intintValue()longprivate static final UByte[]mkValues()Generate a cached value for each byte value.private static shortrangeCheck(int value) Throw exception if value out of range (int version)private static shortrangeCheck(long value) Throw exception if value out of range (long version)private static shortrangeCheck(short value) Throw exception if value out of range (short version)private ObjectReplace version read through deserialization with cached version.subtract(int val) Get this number as aBigInteger.toString()static UBytevalueOf(byte value) Get an instance of anunsigned byteby masking it with0xFFi.e.static UBytevalueOf(int value) Get an instance of anunsigned bytestatic UBytevalueOf(long value) Get an instance of anunsigned bytestatic UBytevalueOf(short value) Get an instance of anunsigned bytestatic UByteGet an instance of anunsigned byteprivate static UBytevalueOfUnchecked(short value) Get the value of a short without checking the value.Methods inherited from class Number
byteValue, shortValue
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDGenerated UID- See Also:
-
VALUES
Cached values -
MIN_VALUE
public static final short MIN_VALUEA constant holding the minimum value anunsigned bytecan have, 0.- See Also:
-
MAX_VALUE
public static final short MAX_VALUEA constant holding the maximum value anunsigned bytecan have, 28-1.- See Also:
-
MIN
A constant holding the minimum value anunsigned bytecan have as UByte, 0. -
MAX
A constant holding the maximum value anunsigned bytecan have as UByte, 28-1. -
value
private final short valueThe value modelling the content of thisunsigned byte
-
-
Constructor Details
-
UByte
Create anunsigned byte- Throws:
NumberFormatException- Ifvalueis not in the range of anunsigned byte
-
UByte
Create anunsigned byte- Throws:
NumberFormatException- Ifvalueis not in the range of anunsigned byte
-
UByte
Create anunsigned byte- Throws:
NumberFormatException- Ifvalueis not in the range of anunsigned byte
-
UByte
private UByte(byte value) Create anunsigned byteby masking it with0xFFi.e.(byte) -1becomes(ubyte) 255 -
UByte
Create anunsigned byte- Throws:
NumberFormatException- Ifvaluedoes not contain a parsableunsigned byte.
-
-
Method Details
-
mkValues
Generate a cached value for each byte value.- Returns:
- Array of cached values for UByte.
-
valueOf
Get an instance of anunsigned byte- Throws:
NumberFormatException- Ifvaluedoes not contain a parsableunsigned byte.
-
valueOf
Get an instance of anunsigned byteby masking it with0xFFi.e.(byte) -1becomes(ubyte) 255 -
valueOfUnchecked
Get the value of a short without checking the value.- Throws:
NumberFormatException
-
valueOf
Get an instance of anunsigned byte- Throws:
NumberFormatException- Ifvalueis not in the range of anunsigned byte
-
valueOf
Get an instance of anunsigned byte- Throws:
NumberFormatException- Ifvalueis not in the range of anunsigned byte
-
valueOf
Get an instance of anunsigned byte- Throws:
NumberFormatException- Ifvalueis not in the range of anunsigned byte
-
rangeCheck
Throw exception if value out of range (short version)- Parameters:
value- Value to check- Returns:
- value if it is in range
- Throws:
NumberFormatException- if value is out of range
-
rangeCheck
Throw exception if value out of range (int version)- Parameters:
value- Value to check- Returns:
- value if it is in range
- Throws:
NumberFormatException- if value is out of range
-
rangeCheck
Throw exception if value out of range (long version)- Parameters:
value- Value to check- Returns:
- value if it is in range
- Throws:
NumberFormatException- if value is out of range
-
readResolve
Replace version read through deserialization with cached version. Note that this does not use thevalueOfUnchecked(short)as we have no guarantee that the value from the stream is valid.- Returns:
- cached instance of this object's value
- Throws:
ObjectStreamException
-
intValue
-
longValue
-
floatValue
public float floatValue()- Specified by:
floatValuein classNumber
-
doubleValue
public double doubleValue()- Specified by:
doubleValuein classNumber
-
hashCode
-
equals
-
toString
-
compareTo
- Specified by:
compareToin interfaceComparable<UByte>
-
toBigInteger
Description copied from class:UNumberGet this number as aBigInteger. This is a convenience method for callingnew BigInteger(toString())- Overrides:
toBigIntegerin classUNumber
-
add
- Throws:
NumberFormatException
-
add
- Throws:
NumberFormatException
-
subtract
-
subtract
-