java.lang.Object
org.monte.media.io.ByteArray
Utility methods for reading/writing primitive values into byte arrays.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intgetIntBE(byte[] array, int offset) Reads an int in big endian order at the specified array offset.static intgetIntLE(byte[] array, int offset) Reads an int in little endian order at the specified array offset.static longgetLongBE(byte[] array, int offset) Reads a long in big endian order at the specified array offset.static longgetLongLE(byte[] array, int offset) Reads a long in little endian order at the specified array offset.static shortgetShortBE(byte[] array, int offset) Reads a short in big endian order at the specified array offset.static shortgetShortLE(byte[] array, int offset) Reads a short in little endian order at the specified array offset.static voidsetIntBE(byte[] array, int offset, int value) Writes an int in big endian order at the specified array offset.static voidsetIntLE(byte[] array, int offset, int value) Writes an int in little endian order at the specified array offset.static voidsetLongBE(byte[] array, int offset, long value) Writes a long in big endian order at the specified array offset.static voidsetLongLE(byte[] array, int offset, long value) Writes a long in little endian order at the specified array offset.static voidsetShortBE(byte[] array, int offset, short value) Writes a short in big endian order at the specified array offset.static voidsetShortLE(byte[] array, int offset, short value) Writes a short in little endian order at the specified array offset.
-
Method Details
-
getShortBE
public static short getShortBE(byte[] array, int offset) Reads a short in big endian order at the specified array offset.- Parameters:
array- an arrayoffset- the offset- Returns:
- the value
-
getShortLE
public static short getShortLE(byte[] array, int offset) Reads a short in little endian order at the specified array offset.- Parameters:
array- an arrayoffset- the offset- Returns:
- the value
-
getIntBE
public static int getIntBE(byte[] array, int offset) Reads an int in big endian order at the specified array offset.- Parameters:
array- an arrayoffset- the offset- Returns:
- the value
-
getIntLE
public static int getIntLE(byte[] array, int offset) Reads an int in little endian order at the specified array offset.- Parameters:
array- an arrayoffset- the offset- Returns:
- the value
-
getLongBE
public static long getLongBE(byte[] array, int offset) Reads a long in big endian order at the specified array offset.- Parameters:
array- an arrayoffset- the offset- Returns:
- the value
-
getLongLE
public static long getLongLE(byte[] array, int offset) Reads a long in little endian order at the specified array offset.- Parameters:
array- an arrayoffset- the offset- Returns:
- the value
-
setShortBE
public static void setShortBE(byte[] array, int offset, short value) Writes a short in big endian order at the specified array offset.- Parameters:
array- an arrayoffset- the offsetvalue- the value
-
setShortLE
public static void setShortLE(byte[] array, int offset, short value) Writes a short in little endian order at the specified array offset.- Parameters:
array- an arrayoffset- the offsetvalue- the value
-
setIntBE
public static void setIntBE(byte[] array, int offset, int value) Writes an int in big endian order at the specified array offset.- Parameters:
array- an arrayoffset- the offsetvalue- the value
-
setIntLE
public static void setIntLE(byte[] array, int offset, int value) Writes an int in little endian order at the specified array offset.- Parameters:
array- an arrayoffset- the offsetvalue- the value
-
setLongBE
public static void setLongBE(byte[] array, int offset, long value) Writes a long in big endian order at the specified array offset.- Parameters:
array- an arrayoffset- the offsetvalue- the value
-
setLongLE
public static void setLongLE(byte[] array, int offset, long value) Writes a long in little endian order at the specified array offset.- Parameters:
array- an arrayoffset- the offsetvalue- the value
-