Class ByteArrayUtils

  • All Implemented Interfaces:

    
    public class ByteArrayUtils
    
                        

    Contains basic methods for reading/writing values to/from a byte[]s and ByteArrayBuffers.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      ByteArrayUtils()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static int readUint16(ByteArrayBuffer bab, int off) Read a unsigned 16-bit value from a byte array buffer at a specified offset as an int.
      static int readUint16(Array<byte> buf, int off) Read a unsigned 16-bit value from a byte array at a specified offset as an int.
      static void writeUint16(ByteArrayBuffer bab, int off, int value) Writes a 16-bit unsigned integer into a byte array buffer at a specified offset.
      static void writeUint16(Array<byte> buf, int off, int value) Writes a 16-bit unsigned integer into a byte array at a specified offset.
      static int readUint24(ByteArrayBuffer bab, int off) Read a unsigned 24-bit value from a byte array buffer at a specified offset as an int.
      static int readUint24(Array<byte> buf, int off) Read a unsigned 24-bit value from a byte array at a specified offset as an int.
      static void writeUint24(ByteArrayBuffer bab, int off, int value) Writes a 24-bit unsigned integer into a byte array buffer at a specified offset.
      static void writeUint24(Array<byte> buf, int off, int value) Writes a 24-bit unsigned integer into a byte array at a specified offset.
      static long readUint32(ByteArrayBuffer bab, int off) Read a unsigned 32-bit value from a byte array buffer at a specified offset as a long.
      static long readUint32(Array<byte> buf, int off) Read a unsigned 32-bit value from a byte array at a specified offset as a long.
      static int readInt(ByteArrayBuffer bab, int off) Read a 32-bit integer from a byte array buffer at a specified offset.
      static int readInt(Array<byte> buf, int off) Read a 32-bit integer from a byte array at a specified offset.
      static void writeInt(ByteArrayBuffer bab, int off, int value) Writes an int into a byte array buffer at a specified offset.
      static void writeInt(Array<byte> buf, int off, int value) Writes an int into a byte array at a specified offset.
      static short readShort(ByteArrayBuffer bab, int off) Read a 16-bit signed integer from a byte array buffer at a specified offset into a short.
      static short readShort(Array<byte> buf, int off) Read a 16-bit signed integer from a byte array at a specified offset into a short.
      static void writeShort(ByteArrayBuffer bab, int off, short value) Writes a short into a byte array buffer at a specified offset.
      static void writeShort(Array<byte> buf, int off, short value) Writes a short into a byte array at a specified offset.
      • Methods inherited from class java.lang.Object

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

      • ByteArrayUtils

        ByteArrayUtils()
    • Method Detail

      • readUint16

         static int readUint16(ByteArrayBuffer bab, int off)

        Read a unsigned 16-bit value from a byte array buffer at a specified offset as an int.

        Parameters:
        bab - the buffer from which to read.
        off - start offset of the unsigned short
        Returns:

        the int value of the unsigned short at offset

      • readUint16

         static int readUint16(Array<byte> buf, int off)

        Read a unsigned 16-bit value from a byte array at a specified offset as an int.

        Parameters:
        buf - the buffer from which to read.
        off - start offset of the unsigned short
        Returns:

        the int value of the unsigned short at offset

      • writeUint16

         static void writeUint16(ByteArrayBuffer bab, int off, int value)

        Writes a 16-bit unsigned integer into a byte array buffer at a specified offset.

        Parameters:
        bab - the byte array to write to.
        value - the value to write.
      • writeUint16

         static void writeUint16(Array<byte> buf, int off, int value)

        Writes a 16-bit unsigned integer into a byte array at a specified offset.

        Parameters:
        buf - the byte array to write to.
        value - the value to write.
      • readUint24

         static int readUint24(ByteArrayBuffer bab, int off)

        Read a unsigned 24-bit value from a byte array buffer at a specified offset as an int.

        Parameters:
        bab - the buffer from which to read.
        off - start offset of the unsigned short
        Returns:

        the int value of the unsigned short at offset

      • readUint24

         static int readUint24(Array<byte> buf, int off)

        Read a unsigned 24-bit value from a byte array at a specified offset as an int.

        Parameters:
        buf - the buffer from which to read.
        off - start offset of the unsigned short
        Returns:

        the int value of the unsigned short at offset

      • writeUint24

         static void writeUint24(ByteArrayBuffer bab, int off, int value)

        Writes a 24-bit unsigned integer into a byte array buffer at a specified offset.

        Parameters:
        bab - the byte array to write to.
        value - the value to write.
      • writeUint24

         static void writeUint24(Array<byte> buf, int off, int value)

        Writes a 24-bit unsigned integer into a byte array at a specified offset.

        Parameters:
        buf - the byte array to write to.
        value - the value to write.
      • readUint32

         static long readUint32(ByteArrayBuffer bab, int off)

        Read a unsigned 32-bit value from a byte array buffer at a specified offset as a long.

        Parameters:
        bab - the buffer from which to read.
        off - start offset of the unsigned short
        Returns:

        the int value of the unsigned short at offset

      • readUint32

         static long readUint32(Array<byte> buf, int off)

        Read a unsigned 32-bit value from a byte array at a specified offset as a long.

        Parameters:
        buf - the buffer from which to read.
        off - start offset of the unsigned short
        Returns:

        the int value of the unsigned short at offset

      • readInt

         static int readInt(ByteArrayBuffer bab, int off)

        Read a 32-bit integer from a byte array buffer at a specified offset.

        Parameters:
        bab - the byte array from which to read.
        off - start offset in the buffer of the integer to be read.
      • readInt

         static int readInt(Array<byte> buf, int off)

        Read a 32-bit integer from a byte array at a specified offset.

        Parameters:
        buf - the byte array from which to read.
        off - start offset in the buffer of the integer to be read.
      • writeInt

         static void writeInt(ByteArrayBuffer bab, int off, int value)

        Writes an int into a byte array buffer at a specified offset.

        Parameters:
        bab - the byte array to write to.
        value - the value to write.
      • writeInt

         static void writeInt(Array<byte> buf, int off, int value)

        Writes an int into a byte array at a specified offset.

        Parameters:
        buf - the byte array to write to.
        value - the value to write.
      • readShort

         static short readShort(ByteArrayBuffer bab, int off)

        Read a 16-bit signed integer from a byte array buffer at a specified offset into a short.

        Parameters:
        bab - the byte array from which to read.
        off - start offset in the buffer of the integer to be read.
      • readShort

         static short readShort(Array<byte> buf, int off)

        Read a 16-bit signed integer from a byte array at a specified offset into a short.

        Parameters:
        buf - the byte array from which to read.
        off - start offset in the buffer of the integer to be read.
      • writeShort

         static void writeShort(ByteArrayBuffer bab, int off, short value)

        Writes a short into a byte array buffer at a specified offset.

        Parameters:
        bab - the byte array to write to.
        value - the value to write.
      • writeShort

         static void writeShort(Array<byte> buf, int off, short value)

        Writes a short into a byte array at a specified offset.

        Parameters:
        buf - the byte array to write to.
        value - the value to write.