public class SerializerBase extends Object implements Serializer<Object>
| Modifier and Type | Class and Description |
|---|---|
protected static class |
SerializerBase.FastArrayList<K>
Utility class similar to ArrayList, but with fast identity search.
|
protected static interface |
SerializerBase.Header
Header byte, is used at start of each record to indicate data type
WARNING !!! values bellow must be unique !!!!!
|
protected static interface |
SerializerBase.HeaderMapDB |
protected static class |
SerializerBase.singletons |
Serializer.CompressionWrapper<E>| Modifier and Type | Field and Description |
|---|---|
protected static String |
EMPTY_STRING |
BASIC, BOOLEAN, BYTE_ARRAY, BYTE_ARRAY_NOSIZE, CHAR_ARRAY, DOUBLE_ARRAY, ILLEGAL_ACCESS, INT_ARRAY, INTEGER, JAVA, LONG, LONG_ARRAY, STRING, STRING_ASCII, STRING_INTERN, STRING_NOSIZE, UUID| Constructor and Description |
|---|
SerializerBase() |
| Modifier and Type | Method and Description |
|---|---|
static void |
assertSerializable(Object o) |
protected static byte[] |
booleanToByteArray(boolean[] bool)
Builds a byte array from the array of booleans, compressing up to 8 booleans per byte.
|
Object |
deserialize(DataInput is,
int capacity)
Deserialize the content of an object from a DataInput.
|
Object |
deserialize(DataInput is,
SerializerBase.FastArrayList<Object> objectStack) |
protected Class |
deserializeClass(DataInput is) |
protected Object |
deserializeMapDB(DataInput is,
SerializerBase.FastArrayList<Object> objectStack) |
protected Object |
deserializeUnknownHeader(DataInput is,
int head,
SerializerBase.FastArrayList<Object> objectStack)
override this method to extend SerializerBase functionality
|
int |
fixedSize()
Data could be serialized into record with variable size or fixed size.
|
protected Engine |
getEngine() |
protected static boolean[] |
readBooleanArray(int numBools,
DataInput is)
Unpacks an integer from the DataInput indicating the number of booleans that are compressed.
|
void |
serialize(DataOutput out,
Object obj)
Serialize the content of an object into a ObjectOutput
|
void |
serialize(DataOutput out,
Object obj,
SerializerBase.FastArrayList<Object> objectStack) |
protected void |
serializeClass(DataOutput out,
Class clazz) |
protected void |
serializeUnknownObject(DataOutput out,
Object obj,
SerializerBase.FastArrayList<Object> objectStack)
override this method to extend SerializerBase functionality
|
protected static final String EMPTY_STRING
public void serialize(DataOutput out, Object obj) throws IOException
Serializerserialize in interface Serializer<Object>out - ObjectOutput to save object intoobj - Object to serializeIOExceptionpublic void serialize(DataOutput out, Object obj, SerializerBase.FastArrayList<Object> objectStack) throws IOException
IOExceptionprotected void serializeClass(DataOutput out, Class clazz) throws IOException
IOExceptionpublic Object deserialize(DataInput is, int capacity) throws IOException
Serializerdeserialize in interface Serializer<Object>is - to read serialized data fromcapacity - how many bytes are available in DataInput for reading, may be -1 (in streams) or 0 (null).IOExceptionpublic Object deserialize(DataInput is, SerializerBase.FastArrayList<Object> objectStack) throws IOException
IOExceptionpublic static void assertSerializable(Object o)
protected Object deserializeMapDB(DataInput is, SerializerBase.FastArrayList<Object> objectStack) throws IOException
IOExceptionprotected Engine getEngine()
protected Class deserializeClass(DataInput is) throws IOException
IOExceptionprotected void serializeUnknownObject(DataOutput out, Object obj, SerializerBase.FastArrayList<Object> objectStack) throws IOException
IOExceptionprotected Object deserializeUnknownHeader(DataInput is, int head, SerializerBase.FastArrayList<Object> objectStack) throws IOException
IOExceptionprotected static byte[] booleanToByteArray(boolean[] bool)
bool - The booleans to be compressed.protected static boolean[] readBooleanArray(int numBools,
DataInput is)
throws IOException
numBools elements. This is
necessary in situations where the number of booleans is not a multiple of 8.
Author of this method is Chris Alexander.IOException - If an error occurred while reading.public int fixedSize()
SerializerfixedSize in interface Serializer<Object>Copyright © 2024. All rights reserved.