Package tools

Class BytesArrayTools


  • public class BytesArrayTools
    extends java.lang.Object
    Helper to manipulate byte[].
    Version:
    1.0
    Author:
    Louis Royer, Flavien Haas, JS Auge
    • Constructor Summary

      Constructors 
      Constructor Description
      BytesArrayTools()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int readInt​(byte[] array, int start)
      Read int from a bytearray
      static long readLong​(byte[] array, int start)
      Read long from a bytearray
      static void write​(byte[] array, int start, int value)
      Write int in a bytearray
      static void write​(byte[] array, int start, long value)
      Write long in a bytearray
      • Methods inherited from class java.lang.Object

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

      • BytesArrayTools

        public BytesArrayTools()
    • Method Detail

      • write

        public static void write​(byte[] array,
                                 int start,
                                 int value)
        Write int in a bytearray
        Parameters:
        array - the array to write
        start - where to begin writting
        value - int to write
      • write

        public static void write​(byte[] array,
                                 int start,
                                 long value)
        Write long in a bytearray
        Parameters:
        array - the array to write
        start - where to begin writting
        value - long to write
      • readInt

        public static int readInt​(byte[] array,
                                  int start)
                           throws SizeError
        Read int from a bytearray
        Parameters:
        array - the array to read
        start - where to begin reading
        Returns:
        value read as int
        Throws:
        SizeError
      • readLong

        public static long readLong​(byte[] array,
                                    int start)
                             throws SizeError
        Read long from a bytearray
        Parameters:
        array - the array to read
        start - where to begin reading
        Returns:
        value read as long
        Throws:
        SizeError