Package org.apache.directory.api.util
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
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
deserializeBoolean(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 int
deserializeInt(byte[] buffer, int pos)
Read an integer from a buffer at a given positionstatic int
serialize(byte[] value, byte[] buffer, int pos)
Write a byte[] into a buffer at a given positionstatic int
serialize(int value, byte[] buffer, int pos)
Write an integer into a buffer at a given position
-
-
-
Field Detail
-
TRUE
public static final byte TRUE
The serialized value for TRUE- See Also:
- Constant Field Values
-
FALSE
public static final byte FALSE
The serialized value for FALSE- See Also:
- Constant Field Values
-
-
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 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
-
-