|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mapdb.SerializerBase
public class SerializerBase
Serializer which uses 'header byte' to serialize/deserialize most of classes from 'java.lang' and 'java.util' packages.
| Nested Class Summary | |
|---|---|
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
|
| Nested classes/interfaces inherited from interface org.mapdb.Serializer |
|---|
Serializer.CompressionWrapper<E> |
| Field Summary | |
|---|---|
protected static String |
EMPTY_STRING
|
| Fields inherited from interface org.mapdb.Serializer |
|---|
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 Summary | |
|---|---|
SerializerBase()
|
|
| Method Summary | |
|---|---|
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 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String EMPTY_STRING
| Constructor Detail |
|---|
public SerializerBase()
| Method Detail |
|---|
public void serialize(DataOutput out,
Object obj)
throws IOException
Serializer
serialize in interface Serializer<Object>out - ObjectOutput to save object intoobj - Object to serialize
IOException
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
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
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
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()
Serializer
fixedSize in interface Serializer<Object>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||