org.mapdb
Class SerializerBase
- java.lang.Object
-
- org.mapdb.Serializer<java.lang.Object>
-
- org.mapdb.SerializerBase
-
- Direct Known Subclasses:
- SerializerPojo
public class SerializerBase extends Serializer<java.lang.Object>
Serializer which uses 'header byte' to serialize/deserialize most of classes from 'java.lang' and 'java.util' packages.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.mapdb.Serializer
Serializer.Array<T>, Serializer.CompressionDeflateWrapper<E>, Serializer.CompressionWrapper<E>
-
-
Field Summary
-
Fields inherited from class org.mapdb.Serializer
BASIC, 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 Summary
Constructors Constructor and Description SerializerBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidassertSerializable(java.lang.Object o)java.lang.Objectdeserialize(java.io.DataInput in, int capacity)Deserialize the content of an object from a DataInput.java.lang.Objectdeserialize(java.io.DataInput in, org.mapdb.SerializerBase.FastArrayList<java.lang.Object> objectStack)booleanequalsBinary(java.lang.Object a1, java.lang.Object a2)Tries to serialize two object and return true if they are binary equalbooleanisSerializable(java.lang.Object o)return true if mapdb knows howto serialize given objectbooleanisTrusted()MapDB has relax record size boundary checking.voidserialize(java.io.DataOutput out, java.lang.Object obj)Serialize the content of an object into a ObjectOutputvoidserialize(java.io.DataOutput out, java.lang.Object obj, org.mapdb.SerializerBase.FastArrayList<java.lang.Object> objectStack)voidserializeObjectArray(java.io.DataOutput out, java.lang.Object[] b, org.mapdb.SerializerBase.FastArrayList objectStack)-
Methods inherited from class org.mapdb.Serializer
equals, fixedSize, getBTreeKeySerializer, hashCode, valueArrayCopyOfRange, valueArrayDeleteValue, valueArrayDeserialize, valueArrayEmpty, valueArrayFromArray, valueArrayGet, valueArrayPut, valueArraySerialize, valueArraySize, valueArrayUpdateVal
-
-
-
-
Method Detail
-
serializeObjectArray
public void serializeObjectArray(java.io.DataOutput out, java.lang.Object[] b, org.mapdb.SerializerBase.FastArrayList objectStack) throws java.io.IOException- Throws:
java.io.IOException
-
serialize
public void serialize(java.io.DataOutput out, java.lang.Object obj) throws java.io.IOExceptionDescription copied from class:SerializerSerialize the content of an object into a ObjectOutput- Specified by:
serializein classSerializer<java.lang.Object>- Parameters:
out- ObjectOutput to save object intoobj- Object to serialize- Throws:
java.io.IOException- in case of IO error
-
serialize
public void serialize(java.io.DataOutput out, java.lang.Object obj, org.mapdb.SerializerBase.FastArrayList<java.lang.Object> objectStack) throws java.io.IOException- Throws:
java.io.IOException
-
deserialize
public java.lang.Object deserialize(java.io.DataInput in, int capacity) throws java.io.IOExceptionDescription copied from class:SerializerDeserialize the content of an object from a DataInput.- Specified by:
deserializein classSerializer<java.lang.Object>- Parameters:
in- to read serialized data fromcapacity- how many bytes are available in DataInput for reading, may be -1 (in streams) or 0 (null).- Returns:
- deserialized object
- Throws:
java.io.IOException- in case of IO error
-
deserialize
public java.lang.Object deserialize(java.io.DataInput in, org.mapdb.SerializerBase.FastArrayList<java.lang.Object> objectStack) throws java.io.IOException- Throws:
java.io.IOException
-
assertSerializable
public void assertSerializable(java.lang.Object o)
-
isTrusted
public boolean isTrusted()
Description copied from class: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.
- Overrides:
isTrustedin classSerializer<java.lang.Object>- Returns:
- true if this serializer is well tested and writes as many bytes as it reads.
-
isSerializable
public boolean isSerializable(java.lang.Object o)
return true if mapdb knows howto serialize given object
-
equalsBinary
public boolean equalsBinary(java.lang.Object a1, java.lang.Object a2)Tries to serialize two object and return true if they are binary equal- Parameters:
a1- first objecta2- second object- Returns:
- true if objects are equal or binary equal, false if not equal or some failure happend
-
-
DataMelt 3.0 © DataMelt by jWork.ORG