Class Serialize

java.lang.Object
org.apache.directory.api.util.Serialize

public final class Serialize extends Object
A class containing static methods used to serialize and deserialize base types
Author:
Apache Directory Project
  • Field Summary

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

    Modifier and Type
    Method
    Description
    static boolean
    deserializeBoolean(byte[] buffer, int pos)
    Read a boolean from a buffer at a given position
    static byte[]
    deserializeBytes(byte[] buffer, int pos)
    Read a byte[] from a buffer at a given position
    static int
    deserializeInt(byte[] buffer, int pos)
    Read an integer from a buffer at a given position
    static int
    serialize(byte[] value, byte[] buffer, int pos)
    Write a byte[] into a buffer at a given position
    static int
    serialize(int value, byte[] buffer, int pos)
    Write an integer into a buffer at a given position

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • 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