Class ByteArray

java.lang.Object
org.monte.media.io.ByteArray

public class ByteArray extends Object
Utility methods for reading/writing primitive values into byte arrays.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    getIntBE(byte[] array, int offset)
    Reads an int in big endian order at the specified array offset.
    static int
    getIntLE(byte[] array, int offset)
    Reads an int in little endian order at the specified array offset.
    static long
    getLongBE(byte[] array, int offset)
    Reads a long in big endian order at the specified array offset.
    static long
    getLongLE(byte[] array, int offset)
    Reads a long in little endian order at the specified array offset.
    static short
    getShortBE(byte[] array, int offset)
    Reads a short in big endian order at the specified array offset.
    static short
    getShortLE(byte[] array, int offset)
    Reads a short in little endian order at the specified array offset.
    static void
    setIntBE(byte[] array, int offset, int value)
    Writes an int in big endian order at the specified array offset.
    static void
    setIntLE(byte[] array, int offset, int value)
    Writes an int in little endian order at the specified array offset.
    static void
    setLongBE(byte[] array, int offset, long value)
    Writes a long in big endian order at the specified array offset.
    static void
    setLongLE(byte[] array, int offset, long value)
    Writes a long in little endian order at the specified array offset.
    static void
    setShortBE(byte[] array, int offset, short value)
    Writes a short in big endian order at the specified array offset.
    static void
    setShortLE(byte[] array, int offset, short value)
    Writes a short in little endian order at the specified array offset.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 array
      offset - 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 array
      offset - 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 array
      offset - 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 array
      offset - 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 array
      offset - 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 array
      offset - 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 array
      offset - the offset
      value - 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 array
      offset - the offset
      value - 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 array
      offset - the offset
      value - 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 array
      offset - the offset
      value - 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 array
      offset - the offset
      value - 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 array
      offset - the offset
      value - the value