- All Implemented Interfaces:
Serializable
,Comparable<Endianess>
,Constable
An enumeration of valid endianess.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
toBytes
(double aValue) Converts the given value to a byte array in the according endian notation.byte[]
toBytes
(float aValue) Converts the given value to a byte array in the according endian notation.byte[]
toBytes
(int aValue) Converts the given value to a byte array in the according endian notation.byte[]
toBytes
(int aValue, int aLength) Converts the given value to a byte array in the according endian notation.byte[]
toBytes
(long aValue) Converts the given value to a byte array in the according endian notation.byte[]
toBytes
(long aValue, int aLength) Converts the given value to a byte array in the according endian notation.byte[]
toBytes
(short aValue) Converts the given value to a byte array in the according endian notation.byte[]
toBytes
(short aValue, int aLength) Converts the given value to a byte array in the according endian notation.double
toDouble
(byte[] aBytes) Converts a byte array in according endianess to an double value.float
toFloat
(byte[] aBytes) Converts a byte array in according endianess to an float value.int
toInteger
(byte[] aBytes) Converts a byte array in according endianess to an integer value.long
toLong
(byte[] aBytes) Converts a byte array in according endianess to a long value.short
toShort
(byte[] aBytes) Converts a byte array in according endianess to an short value.byte[]
toUnsignedBytes
(int aValue) Converts the given value to a byte array in the according endian notation.byte[]
toUnsignedBytes
(long aValue) Converts the given value to a byte array in the according endian notation.byte[]
toUnsignedBytes
(long aValue, int aLength) Converts the given value to a byte array in the according endian notation.byte[]
toUnsignedBytes
(short aValue) Converts the given value to a byte array in the according endian notation.int
toUnsignedInteger
(byte[] aBytes) Converts a byte array in according endianess to an unsigned integer value.long
toUnsignedLong
(byte[] aBytes) Converts a byte array in according endianess to an unsigned long value.short
toUnsignedShort
(byte[] aBytes) Converts a byte array in according endianess to an unsigned short value.static Endianess
Returns the enum constant of this class with the specified name.static Endianess[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
LITTLE
-
BIG
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
toBytes
public byte[] toBytes(long aValue, int aLength) Converts the given value to a byte array in the according endian notation.- Parameters:
aValue
- The value for which to get the byte array.aLength
- The number of bytes to use.- Returns:
- The according array.
-
toBytes
public byte[] toBytes(long aValue) Converts the given value to a byte array in the according endian notation.- Parameters:
aValue
- The value for which to get the byte array.- Returns:
- The according array.
-
toBytes
public byte[] toBytes(int aValue, int aLength) Converts the given value to a byte array in the according endian notation.- Parameters:
aValue
- The value for which to get the byte array.aLength
- The number of bytes to use.- Returns:
- The according array.
-
toBytes
public byte[] toBytes(int aValue) Converts the given value to a byte array in the according endian notation.- Parameters:
aValue
- The value for which to get the byte array.- Returns:
- The according array.
-
toBytes
public byte[] toBytes(short aValue, int aLength) Converts the given value to a byte array in the according endian notation.- Parameters:
aValue
- The value for which to get the byte array.aLength
- The number of bytes to use.- Returns:
- The according array.
-
toBytes
public byte[] toBytes(short aValue) Converts the given value to a byte array in the according endian notation.- Parameters:
aValue
- The value for which to get the byte array.- Returns:
- The according array.
-
toBytes
public byte[] toBytes(float aValue) Converts the given value to a byte array in the according endian notation. As the float type is 32 bits in java, an array of length 4 will be returned.- Parameters:
aValue
- The value for which to get the byte array.- Returns:
- The according array.
-
toBytes
public byte[] toBytes(double aValue) Converts the given value to a byte array in the according endian notation. As the float type is 32 bits in java, an array of length 4 will be returned.- Parameters:
aValue
- The value for which to get the byte array.- Returns:
- The according array.
-
toUnsignedBytes
public byte[] toUnsignedBytes(long aValue, int aLength) Converts the given value to a byte array in the according endian notation.- Parameters:
aValue
- The value for which to get the byte array.aLength
- The number of bytes to use.- Returns:
- The according array.
-
toUnsignedBytes
public byte[] toUnsignedBytes(long aValue) Converts the given value to a byte array in the according endian notation.- Parameters:
aValue
- The value for which to get the byte array.- Returns:
- The according array.
-
toUnsignedBytes
public byte[] toUnsignedBytes(int aValue) Converts the given value to a byte array in the according endian notation.- Parameters:
aValue
- The value for which to get the byte array.- Returns:
- The according array.
-
toUnsignedBytes
public byte[] toUnsignedBytes(short aValue) Converts the given value to a byte array in the according endian notation.- Parameters:
aValue
- The value for which to get the byte array.- Returns:
- The according array.
-
toLong
public long toLong(byte[] aBytes) Converts a byte array in according endianess to a long value.- Parameters:
aBytes
- The byte array to be converted.- Returns:
- The resulting long value.
-
toUnsignedLong
public long toUnsignedLong(byte[] aBytes) Converts a byte array in according endianess to an unsigned long value.- Parameters:
aBytes
- The byte array to be converted.- Returns:
- The resulting long value.
-
toInteger
public int toInteger(byte[] aBytes) Converts a byte array in according endianess to an integer value.- Parameters:
aBytes
- The byte array to be converted.- Returns:
- The resulting integer value.
-
toUnsignedInteger
public int toUnsignedInteger(byte[] aBytes) Converts a byte array in according endianess to an unsigned integer value.- Parameters:
aBytes
- The byte array to be converted.- Returns:
- The resulting integer value.
-
toShort
public short toShort(byte[] aBytes) Converts a byte array in according endianess to an short value.- Parameters:
aBytes
- The byte array to be converted.- Returns:
- The resulting short value.
-
toUnsignedShort
public short toUnsignedShort(byte[] aBytes) Converts a byte array in according endianess to an unsigned short value.- Parameters:
aBytes
- The byte array to be converted.- Returns:
- The resulting short value.
-
toFloat
public float toFloat(byte[] aBytes) Converts a byte array in according endianess to an float value.- Parameters:
aBytes
- The byte array to be converted.- Returns:
- The resulting float value.
-
toDouble
public double toDouble(byte[] aBytes) Converts a byte array in according endianess to an double value.- Parameters:
aBytes
- The byte array to be converted.- Returns:
- The resulting double value.
-