Class Raw


  • public class Raw
    extends java.lang.Object
    Read / write numbers to a byte[] regarding the endianness of the array
    Version:
    $LastChangedRevision$
    • Constructor Summary

      Constructors 
      Constructor Description
      Raw()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void incShortLittleEndian​(byte[] array, int pos, int dv)
      Increment a short value at the specified position by the specified amount (little endian).
      static int readIntBigEndian​(byte[] array, int pos)
      Read a int value from the byte array at the given position (Big Endian)
      static int readIntLittleEndian​(byte[] array, int pos)
      Read an int value from the byte array at the given position (little Endian)
      static long readIntLittleEndianAsLong​(byte[] array, int pos)
      Read an long value(unsigned int) from the byte array at the given position (little Endian)
      static long readLongBigEndian​(byte[] array, int pos)
      Read a long value from the byte array at the given position (Big Endian)
      static long readLongLittleEndian​(byte[] array, int pos)
      Read a long value from the byte array at the given position (little Endian)
      static short readShortBigEndian​(byte[] array, int pos)
      Read a short value from the byte array at the given position (Big Endian)
      static short readShortLittleEndian​(byte[] array, int pos)
      Read a short value from the byte array at the given position (little Endian)
      static void writeIntBigEndian​(byte[] array, int pos, int value)
      Write an int value into the byte array at the given position (Big endian)
      static void writeIntLittleEndian​(byte[] array, int pos, int value)
      Write an int value into the byte array at the given position (little endian)
      static void writeLongBigEndian​(byte[] array, int pos, long value)
      Write a long value into the byte array at the given position (Big endian)
      static void writeLongLittleEndian​(byte[] array, int pos, long value)
      Write a long value into the byte array at the given position (little endian)
      static void writeShortBigEndian​(byte[] array, int pos, short value)
      Write a short value into the byte array at the given position (Big endian)
      static void writeShortLittleEndian​(byte[] array, int pos, short value)
      Write a short value into the byte array at the given position (little endian)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Raw

        public Raw()
    • Method Detail

      • readShortBigEndian

        public static short readShortBigEndian​(byte[] array,
                                               int pos)
        Read a short value from the byte array at the given position (Big Endian)
        Parameters:
        array - the array to read from
        pos - the position
        Returns:
        the value
      • readIntBigEndian

        public static int readIntBigEndian​(byte[] array,
                                           int pos)
        Read a int value from the byte array at the given position (Big Endian)
        Parameters:
        array - the array to read from
        pos - the offset
        Returns:
        the value
      • readLongBigEndian

        public static long readLongBigEndian​(byte[] array,
                                             int pos)
        Read a long value from the byte array at the given position (Big Endian)
        Parameters:
        array - the array to read from
        pos - the offset
        Returns:
        the value
      • readShortLittleEndian

        public static short readShortLittleEndian​(byte[] array,
                                                  int pos)
        Read a short value from the byte array at the given position (little Endian)
        Parameters:
        array - the array to read from
        pos - the offset
        Returns:
        the value
      • readIntLittleEndian

        public static int readIntLittleEndian​(byte[] array,
                                              int pos)
        Read an int value from the byte array at the given position (little Endian)
        Parameters:
        array - the array to read from
        pos - the offset
        Returns:
        the value
      • readIntLittleEndianAsLong

        public static long readIntLittleEndianAsLong​(byte[] array,
                                                     int pos)
        Read an long value(unsigned int) from the byte array at the given position (little Endian)
        Parameters:
        array - .
        pos - .
        Returns:
        .
      • readLongLittleEndian

        public static long readLongLittleEndian​(byte[] array,
                                                int pos)
        Read a long value from the byte array at the given position (little Endian)
        Parameters:
        array - the array to read from
        pos - the offset
        Returns:
        the value
      • writeShortBigEndian

        public static void writeShortBigEndian​(byte[] array,
                                               int pos,
                                               short value)
        Write a short value into the byte array at the given position (Big endian)
        Parameters:
        array - the array
        pos - the offset
        value - the value to write
      • writeIntBigEndian

        public static void writeIntBigEndian​(byte[] array,
                                             int pos,
                                             int value)
        Write an int value into the byte array at the given position (Big endian)
        Parameters:
        array - the array
        pos - the offset
        value - the value to write
      • writeLongBigEndian

        public static void writeLongBigEndian​(byte[] array,
                                              int pos,
                                              long value)
        Write a long value into the byte array at the given position (Big endian)
        Parameters:
        array - the array
        pos - the offset
        value - the value to write
      • writeShortLittleEndian

        public static void writeShortLittleEndian​(byte[] array,
                                                  int pos,
                                                  short value)
        Write a short value into the byte array at the given position (little endian)
        Parameters:
        array - the array
        pos - the offset
        value - the value to write
      • incShortLittleEndian

        public static void incShortLittleEndian​(byte[] array,
                                                int pos,
                                                int dv)
        Increment a short value at the specified position by the specified amount (little endian).
        Parameters:
        array - .
        pos - .
        dv - .
      • writeIntLittleEndian

        public static void writeIntLittleEndian​(byte[] array,
                                                int pos,
                                                int value)
        Write an int value into the byte array at the given position (little endian)
        Parameters:
        array - the array
        pos - the offset
        value - the value to write
      • writeLongLittleEndian

        public static void writeLongLittleEndian​(byte[] array,
                                                 int pos,
                                                 long value)
        Write a long value into the byte array at the given position (little endian)
        Parameters:
        array - the array
        pos - the offset
        value - the value to write