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
Serializer
serialize
in interface Serializer<Object>
out
- ObjectOutput to save object intoobj
- Object to serializeIOException
public void serialize(DataOutput out, Object obj, SerializerBase.FastArrayList<Object> objectStack) throws IOException
IOException
protected void serializeClass(DataOutput out, Class clazz) throws IOException
IOException
public Object deserialize(DataInput is, int capacity) throws IOException
Serializer
deserialize
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).IOException
public Object deserialize(DataInput is, SerializerBase.FastArrayList<Object> objectStack) throws IOException
IOException
public static void assertSerializable(Object o)
protected Object deserializeMapDB(DataInput is, SerializerBase.FastArrayList<Object> objectStack) throws IOException
IOException
protected Engine getEngine()
protected Class deserializeClass(DataInput is) throws IOException
IOException
protected void serializeUnknownObject(DataOutput out, Object obj, SerializerBase.FastArrayList<Object> objectStack) throws IOException
IOException
protected Object deserializeUnknownHeader(DataInput is, int head, SerializerBase.FastArrayList<Object> objectStack) throws IOException
IOException
protected 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()
Serializer
fixedSize
in interface Serializer<Object>
Copyright © 2014. All Rights Reserved.