public class ByteArraySerializer extends java.lang.Object implements Serializer<byte[]>
Serializer for byte[] type. Simply writes the byte array
to a byte buffer.
Note that equals(byte[], ByteBuffer) does not follow the byte[].equals(Object) contract but does
byte-to-byte comparison of both byte arrays.
| Constructor and Description |
|---|
ByteArraySerializer()
No arg constructor
|
ByteArraySerializer(java.lang.ClassLoader classLoader)
Constructor to enable this serializer as a transient one.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(byte[] object,
java.nio.ByteBuffer binary)
Checks if the given instance and serial form
represent the same instance. |
byte[] |
read(java.nio.ByteBuffer binary)
Reconstructs an instance from the given serial form.
|
java.nio.ByteBuffer |
serialize(byte[] object)
Transforms the given instance into its serial form.
|
public ByteArraySerializer()
public ByteArraySerializer(java.lang.ClassLoader classLoader)
Parameter is ignored as byte[] is a base java type.
classLoader - the classloader to useSerializerpublic java.nio.ByteBuffer serialize(byte[] object)
throws SerializerException
serialize in interface Serializer<byte[]>object - the instance to serializeSerializerException - if serialization failspublic byte[] read(java.nio.ByteBuffer binary)
read in interface Serializer<byte[]>binary - the binary representation of the serial formpublic boolean equals(byte[] object,
java.nio.ByteBuffer binary)
represent the same instance.equals in interface Serializer<byte[]>object - the instance to checkbinary - the serial form to checktrue if both parameters represent equal instances, false otherwise