Class Serialize

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static byte FALSE
      The serialized value for FALSE
      static byte TRUE
      The serialized value for TRUE
    • Method Detail

      • serialize

        public static int serialize​(int value,
                                    byte[] buffer,
                                    int pos)
        Write an integer into a buffer at a given position
        Parameters:
        value - The value to serialize
        buffer - The buffer to store the value into
        pos - The position where we serialize the integer
        Returns:
        The new position in the byte[]
      • serialize

        public static int serialize​(byte[] value,
                                    byte[] buffer,
                                    int pos)
        Write a byte[] into a buffer at a given position
        Parameters:
        value - The value to serialize
        buffer - The buffer to store the value into
        pos - The position where we serialize the byte[]
        Returns:
        The new position in the byte[]
      • deserializeInt

        public static int deserializeInt​(byte[] buffer,
                                         int pos)
        Read an integer from a buffer at a given position
        Parameters:
        buffer - The buffer containing the serialized integer
        pos - The position from which we will read an integer
        Returns:
        the deserialized integer
      • deserializeBytes

        public static byte[] deserializeBytes​(byte[] buffer,
                                              int pos)
        Read a byte[] from a buffer at a given position
        Parameters:
        buffer - The buffer containing the serialized byte[]
        pos - The position from which we will read a byte[]
        Returns:
        the deserialized byte[]
      • deserializeBoolean

        public static boolean deserializeBoolean​(byte[] buffer,
                                                 int pos)
        Read a boolean from a buffer at a given position
        Parameters:
        buffer - The buffer containing the serialized boolean
        pos - The position from which we will read a boolean
        Returns:
        the deserialized boolean