public class SerializerBase extends Serializer<Object>
| Modifier and Type | Class and Description |
|---|---|
protected static class |
SerializerBase.Deser<A> |
protected static class |
SerializerBase.DeserInt |
protected static class |
SerializerBase.DeserLong |
protected static class |
SerializerBase.DeserSerializer |
protected class |
SerializerBase.DeserSingleton
always returns single object without reading anything
|
protected static class |
SerializerBase.DeserStringLen |
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 interface |
SerializerBase.Ser<A> |
protected class |
SerializerBase.SerHeader
writes single byte header
|
protected static class |
SerializerBase.SerHeaderSerializer |
Serializer.Array<T>, Serializer.BooleanSer, Serializer.CompressionDeflateWrapper<E>, Serializer.CompressionWrapper<E>, Serializer.EightByteSerializer<E>, Serializer.FourByteSerializer<E>, Serializer.IntegerSerializer, Serializer.LongSerializerBASIC, BIG_DECIMAL, BIG_INTEGER, BOOLEAN, BOOLEAN_ARRAY, BYTE, BYTE_ARRAY, BYTE_ARRAY_NOSIZE, CHAR, CHAR_ARRAY, CLASS, DATE, DOUBLE, DOUBLE_ARRAY, FLOAT, FLOAT_ARRAY, ILLEGAL_ACCESS, INT_ARRAY, INTEGER, INTEGER_PACKED, INTEGER_PACKED_ZIGZAG, JAVA, LONG, LONG_ARRAY, LONG_PACKED, LONG_PACKED_ZIGZAG, RECID, RECID_ARRAY, SHORT, SHORT_ARRAY, STRING, STRING_ASCII, STRING_INTERN, STRING_NOSIZE, STRING_XXHASH, UUID| Constructor and Description |
|---|
SerializerBase() |
| Modifier and Type | Method and Description |
|---|---|
void |
assertSerializable(Object o) |
Object |
deserialize(DataInput in,
int capacity)
Deserialize the content of an object from a DataInput.
|
Object |
deserialize(DataInput in,
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
|
boolean |
equalsBinary(Object a1,
Object a2)
Tries to serialize two object and return true if they are binary equal
|
protected Engine |
getEngine() |
protected void |
initHeaderDeser() |
protected void |
initMapdb() |
protected void |
initSer() |
boolean |
isSerializable(Object o)
return true if mapdb knows howto serialize given object
|
boolean |
isTrusted()
MapDB has relax record size boundary checking.
|
protected static boolean[] |
readBooleanArray(int numBools,
DataInput is)
Unpacks boolean[], each value in array is represented by single bite
|
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) |
void |
serializeObjectArray(DataOutput out,
Object[] b,
SerializerBase.FastArrayList objectStack) |
protected void |
serializeUnknownObject(DataOutput out,
Object obj,
SerializerBase.FastArrayList<Object> objectStack)
override this method to extend SerializerBase functionality
|
protected static void |
writeBooleanArray(DataOutput out,
boolean[] bool)
Writes boolean[] into output, each value in array is represented by single byte
|
equals, fixedSize, getBTreeKeySerializer, hashCode, valueArrayCopyOfRange, valueArrayDeleteValue, valueArrayDeserialize, valueArrayEmpty, valueArrayFromArray, valueArrayGet, valueArrayPut, valueArraySerialize, valueArraySize, valueArrayUpdateValprotected final Map<Class,SerializerBase.Ser> ser
protected final SerializerBase.Deser[] headerDeser
protected static final SerializerBase.Ser SER_STRING
protected static final SerializerBase.Ser SER_LONG_ARRAY
protected static final SerializerBase.Ser SER_INT_ARRAY
protected static final SerializerBase.Ser SER_DOUBLE
protected static final SerializerBase.Ser SER_FLOAT
protected static final SerializerBase.Ser SER_SHORT
protected static final SerializerBase.Ser SER_CHAR
protected static final SerializerBase.Ser SER_BYTE
protected static final SerializerBase.Ser SER_BOOLEAN
protected static final SerializerBase.Ser SER_LONG
protected static final SerializerBase.Ser SER_INT
protected static final SerializerBase.Ser SER_MA_LONG
protected static final SerializerBase.Ser SER_MA_INT
protected static final SerializerBase.Ser SER_MA_BOOL
protected static final SerializerBase.Ser SER_MA_STRING
protected final SerializerBase.Ser SER_MA_VAR
protected static final SerializerBase.Ser<byte[]> SER_BYTE_ARRAY
protected final Store.LongObjectMap<Object> mapdb_reverse
protected void initSer()
public void serializeObjectArray(DataOutput out, Object[] b, SerializerBase.FastArrayList objectStack) throws IOException
IOExceptionprotected void initHeaderDeser()
public void serialize(DataOutput out, Object obj) throws IOException
Serializerserialize in class Serializer<Object>out - ObjectOutput to save object intoobj - Object to serializeIOException - in case of IO errorpublic 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 in, int capacity) throws IOException
Serializerdeserialize in class Serializer<Object>in - to read serialized data fromcapacity - how many bytes are available in DataInput for reading, may be -1 (in streams) or 0 (null).IOException - in case of IO errorpublic Object deserialize(DataInput in, SerializerBase.FastArrayList<Object> objectStack) throws IOException
IOExceptionprotected void initMapdb()
public 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 void writeBooleanArray(DataOutput out, boolean[] bool) throws IOException
bool - The booleans to be writen.IOExceptionprotected static boolean[] readBooleanArray(int numBools,
DataInput is)
throws IOException
IOException - If an error occurred while reading.public boolean isTrusted()
SerializerMapDB has relax record size boundary checking. It expect deserializer to read exactly as many bytes as were writen during serialization. If deserializer reads more bytes it might start reading others record data in store.
Some serializers (Kryo) have problems with this. To prevent this we can not read
data directly from store, but must copy them into separate byte[].
So zero copy optimalizations is disabled by default, and must be explicitly enabled here.
This flag indicates if this serializer was 'verified' to read as many bytes as it writes. It should be also much better tested etc.
isTrusted in class Serializer<Object>public boolean isSerializable(Object o)
Copyright © 2015. All Rights Reserved.