Class Serialize
java.lang.Object
org.apache.directory.api.util.Serialize
A class containing static methods used to serialize and deserialize base types
- Author:
- Apache Directory Project
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleandeserializeBoolean(byte[] buffer, int pos) Read a boolean from a buffer at a given positionstatic byte[]deserializeBytes(byte[] buffer, int pos) Read a byte[] from a buffer at a given positionstatic intdeserializeInt(byte[] buffer, int pos) Read an integer from a buffer at a given positionstatic intserialize(byte[] value, byte[] buffer, int pos) Write a byte[] into a buffer at a given positionstatic intserialize(int value, byte[] buffer, int pos) Write an integer into a buffer at a given position
-
Field Details
-
TRUE
public static final byte TRUEThe serialized value for TRUE- See Also:
-
FALSE
public static final byte FALSEThe serialized value for FALSE- See Also:
-
-
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 serializebuffer- The buffer to store the value intopos- 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 serializebuffer- The buffer to store the value intopos- 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 integerpos- 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 booleanpos- The position from which we will read a boolean- Returns:
- the deserialized boolean
-