org.mapdb.serializer / GroupSerializer

GroupSerializer

interface GroupSerializer<A : Any> : Serializer<A>

Created by jan on 2/29/16.



Inherited Properties

BIG_DECIMAL static val BIG_DECIMAL: GroupSerializer<BigDecimal>
BIG_INTEGER static val BIG_INTEGER: GroupSerializer<BigInteger>
BOOLEAN static val BOOLEAN: GroupSerializer<Boolean>

A predefined Serializer that handles non-null Boolean whereby Booleans are serialized to a one byte format.

If a null value is passed to the Serializer, a NullPointerException will be thrown.

BYTE static val BYTE: GroupSerializer<Byte>

A predefined Serializer that handles non-null Byte whereby Bytes are serialized to a one byte format.

This Serializer hashes Bytes using the original Byte#hashCode() method.

If a null value is passed to the Serializer, a NullPointerException will be thrown.

BYTE_ARRAY static val BYTE_ARRAY: GroupSerializer<ByteArray>

Serializes byte[] it adds header which contains size information

BYTE_ARRAY_DELTA static val BYTE_ARRAY_DELTA: GroupSerializer<ByteArray>
BYTE_ARRAY_DELTA2 static val BYTE_ARRAY_DELTA2: GroupSerializer<ByteArray>
BYTE_ARRAY_NOSIZE static val BYTE_ARRAY_NOSIZE: Serializer<ByteArray>

Serializes byte[] directly into underlying store It does not store size, so it can not be used in Maps and other collections.

CHAR static val CHAR: GroupSerializer<Char>

A predefined Serializer that handles non-null Character.

If a null value is passed to the Serializer, a NullPointerException will be thrown.

CHAR_ARRAY static val CHAR_ARRAY: GroupSerializer<CharArray>

Serializes char[] it adds header which contains size information

CLASS static val CLASS: GroupSerializer<Class<*>>
DATE static val DATE: GroupSerializer<Date>
DOUBLE static val DOUBLE: GroupSerializer<Double>

A predefined Serializer that handles non-null Double whereby Doubles are serialized to an 8 byte format. The Serializer also stores the Float's size, allowing it to be used as a GroupSerializer in BTreeMaps.

This Serializer hashes Doubles using the original Double#hashCode() method.

If a null value is passed to the Serializer, a NullPointerException will be thrown.

DOUBLE_ARRAY static val DOUBLE_ARRAY: GroupSerializer<DoubleArray>

Serializes double[] it adds header which contains size information

ELSA static val ELSA: GroupSerializer<Any>
FLOAT static val FLOAT: GroupSerializer<Float>

A predefined Serializer that handles non-null Float whereby Floats are serialized to a 4 byte format. The Serializer also stores the Float's size, allowing it to be used as a GroupSerializer in BTreeMaps.

This Serializer hashes Floats using the original Float#hashCode() method.

If a null value is passed to the Serializer, a NullPointerException will be thrown.

FLOAT_ARRAY static val FLOAT_ARRAY: GroupSerializer<FloatArray>
ILLEGAL_ACCESS static val ILLEGAL_ACCESS: GroupSerializer<Any>

A predefined Serializer that always throws an IllegalAccessError when invoked.

This serializer can be used for testing and assertions.

INTEGER static val INTEGER: GroupSerializer<Int>

A predefined Serializer that handles non-null Integer whereby Integers are serialized to a 4 byte format.

This Serializer hashes Integers using the original Integer#hashCode() method.

If a null value is passed to the Serializer, a NullPointerException will be thrown.

INTEGER_DELTA static val INTEGER_DELTA: GroupSerializer<Int>

A predefined Serializer that handles non-null Integer whereby Integers are serialized to a compressed byte format and neighboring Integers are delta encoded in BTreeMaps. Neighbors with a small delta can be encoded using a single byte.

Smaller positive values occupy less than 4 bytes. Large and negative values could occupy 4 or 5 bytes.

This Serializer hashes Integers using the original Integer#hashCode() method.

If a null value is passed to the Serializer, a NullPointerException will be thrown.

INTEGER_PACKED static val INTEGER_PACKED: GroupSerializer<Int>

A predefined Serializer that handles non-null Integer whereby Integers are serialized to a compressed byte format.The Serializer also stores the Longs's size, allowing it to be used as a GroupSerializer in BTreeMaps.

Smaller positive values occupy less than 4 bytes. Large and negative values could occupy 4 or 5 bytes.

This Serializer hashes Integers using the original Integer#hashCode() method.

If a null value is passed to the Serializer, a NullPointerException will be thrown.

INT_ARRAY static val INT_ARRAY: GroupSerializer<IntArray>

Serializes int[] it adds header which contains size information

JAVA static val JAVA: GroupSerializer<Any>

A predefined Serializer that handles non-null Serializable Java objects whereby the standard Java serialization will be applied using java.io.ObjectInputStream and java.io.ObjectOutputStream methods.

This Serializer hashes Objects using a specially tailored hash code method that, in turn, is using the objects own hashCode()

If a null value is passed to the Serializer, a NullPointerException will be thrown.

LONG static val LONG: GroupSerializer<Long>

A predefined Serializer that handles non-null Long whereby Longs are serialized to an 8 byte format. The Serializer also stores the Longs's size, allowing it to be used as a GroupSerializer in BTreeMaps.

This Serializer hashes Longs using the original Long#hashCode() method.

If a null value is passed to the Serializer, a NullPointerException will be thrown.

LONG_ARRAY static val LONG_ARRAY: GroupSerializer<LongArray>

Serializes long[] it adds header which contains size information

LONG_DELTA static val LONG_DELTA: GroupSerializer<Long>

A predefined Serializer that handles non-null Long whereby Longs are serialized to a compressed byte format and neighboring Longs are delta encoded in BTreeMaps. Neighbors with a small delta can be encoded using a single byte.

Smaller positive values occupy less than 8 bytes. Large and negative values could occupy 8 or 9 bytes.

This Serializer hashes Longs using the original Long#hashCode() method.

If a null value is passed to the Serializer, a NullPointerException will be thrown.

LONG_PACKED static val LONG_PACKED: GroupSerializer<Long>

A predefined Serializer that handles non-null Long whereby Longs are serialized to a compressed byte format. The Serializer also stores the Longs's size, allowing it to be used as a GroupSerializer in BTreeMaps.

Smaller positive values occupy less than 8 bytes. Large and negative values could occupy 8 or 9 bytes.

This Serializer hashes Longs using the original Long#hashCode() method.

If a null value is passed to the Serializer, a NullPointerException will be thrown.

RECID static val RECID: GroupSerializer<Long>

A predefined Serializer that handles non-null Long used as a recid whereby recids are serialized to an eight byte format including a checksum.

If a null value is passed to the Serializer, a NullPointerException will be thrown.

RECID_ARRAY static val RECID_ARRAY: GroupSerializer<LongArray>

A predefined Serializer that handles non-null arrays of longs used as a recids whereby recids are serialized to an eight byte format including a checksum.

If a null array is passed to the Serializer, a NullPointerException will be thrown.

If an array that contains a null value is passed to the Serializer, a NullPointerException will be thrown.

SHORT static val SHORT: GroupSerializer<Short>

A predefined Serializer that handles non-null Short whereby Shorts are serialized to a 2 byte format. The Serializer also stores the Short's size, allowing it to be used as a GroupSerializer in BTreeMaps.

This Serializer hashes Shorts using the original Short#hashCode() method.

If a null value is passed to the Serializer, a NullPointerException will be thrown.

SHORT_ARRAY static val SHORT_ARRAY: GroupSerializer<ShortArray>
STRING static val STRING: GroupSerializer<String>

A predefined Serializer that handles non-null String whereby Strings are serialized to a UTF-8 encoded format. The Serializer also stores the String's size, allowing it to be used as a GroupSerializer in BTreeMaps.

This Serializer hashes Strings using a specially tailored hash code method as opposed to the Serializer#STRING_ORIGHASH Serializer.

If a null value is passed to the Serializer, a NullPointerException will be thrown.

STRING_ASCII static val STRING_ASCII: GroupSerializer<String>

A predefined Serializer that handles non-null String whereby Strings are serialized to a ASCII encoded format (8 bit character) which is faster than using a UTF-8 format. The Serializer also stores the String's size, allowing it to be used as a GroupSerializer in BTreeMaps.

This Serializer hashes Strings using a specially tailored hash code method as opposed to the Serializer#STRING_ORIGHASH Serializer.

If a null value is passed to the Serializer, a NullPointerException will be thrown.

STRING_DELTA static val STRING_DELTA: GroupSerializer<String>

A predefined Serializer that handles non-null String whereby Strings are serialized to a UTF-8 encoded format. The Serializer also stores the String's size, allowing it to be used as a GroupSerializer in BTreeMaps. Neighboring strings may be delta encoded for increased storage efficency.

This Serializer hashes Strings using a specially tailored hash code method as opposed to the Serializer#STRING_ORIGHASH Serializer.

If a null value is passed to the Serializer, a NullPointerException will be thrown.

STRING_DELTA2 static val STRING_DELTA2: GroupSerializer<String>

A predefined Serializer that handles non-null String whereby Strings are serialized to a UTF-8 encoded format. The Serializer also stores the String's size, allowing it to be used as a GroupSerializer in BTreeMaps. Neighboring strings may be delta encoded for increased storage efficency.

This Serializer hashes Strings using a specially tailored hash code method as opposed to the Serializer#STRING_ORIGHASH Serializer.

If a null value is passed to the Serializer, a NullPointerException will be thrown.

STRING_INTERN static val STRING_INTERN: GroupSerializer<String>

A predefined Serializer that handles non-null String whereby Strings are serialized to a UTF-8 encoded format. The Serializer also stores the String's size, allowing it to be used as a GroupSerializer in BTreeMaps. Neighboring strings may be delta encoded for increased storage efficency.

Deserialized strings are automatically interned String#intern() allowing a more heap space efficient storage for repeated strings.

This Serializer hashes Strings using a specially tailored hash code method as opposed to the Serializer#STRING_ORIGHASH Serializer.

If a null value is passed to the Serializer, a NullPointerException will be thrown.

STRING_NOSIZE static val STRING_NOSIZE: Serializer<String>

A predefined Serializer that handles non-null String whereby Strings are serialized to a UTF-8 encoded format. The Serializer does not store the String's size, thereby preventing it from being used as a GroupSerializer.

This Serializer hashes Strings using the original hash code method as opposed to the Serializer#STRING Serializer.

If a null value is passed to the Serializer, a NullPointerException will be thrown.

STRING_ORIGHASH static val STRING_ORIGHASH: GroupSerializer<String>

A predefined Serializer that handles non-null String whereby Strings are serialized to a UTF-8 encoded format. The Serializer also stores the String's size, allowing it to be used as a GroupSerializer in BTreeMaps.

This Serializer hashes Strings using the original hash code method as opposed to the Serializer#STRING Serializer.

If a null value is passed to the Serializer, a NullPointerException will be thrown.

UUID static val UUID: GroupSerializer<UUID>

Serializers java.util.UUID class

Functions

nextValue open fun nextValue(value: A): A

returns value+1, or null if there is no bigger value.

valueArrayBinaryGet open fun valueArrayBinaryGet(input: DataInput2, keysLen: Int, pos: Int): A
valueArrayBinarySearch open fun valueArrayBinarySearch(key: A, input: DataInput2, keysLen: Int, comparator: Comparator<Any>): Int
valueArrayCopyOfRange abstract fun valueArrayCopyOfRange(vals: Any, from: Int, to: Int): Any
valueArrayDeleteValue abstract fun valueArrayDeleteValue(vals: Any, pos: Int): Any
valueArrayDeserialize abstract fun valueArrayDeserialize(in: DataInput2, size: Int): Any
valueArrayEmpty abstract fun valueArrayEmpty(): Any
valueArrayFromArray abstract fun valueArrayFromArray(objects: Array<Any>): Any
valueArrayGet abstract fun valueArrayGet(vals: Any, pos: Int): A
valueArrayPut abstract fun valueArrayPut(vals: Any, pos: Int, newValue: A): Any
valueArraySearch abstract fun valueArraySearch(keys: Any, key: A): Int
abstract fun valueArraySearch(keys: Any, key: A, comparator: Comparator<Any>): Int
valueArraySerialize abstract fun valueArraySerialize(out: DataOutput2, vals: Any): Unit
valueArraySize abstract fun valueArraySize(vals: Any): Int
valueArrayToArray open fun valueArrayToArray(vals: Any): Array<Any>
valueArrayUpdateVal abstract fun valueArrayUpdateVal(vals: Any, pos: Int, newValue: A): Any

Inherited Functions

deserialize abstract fun deserialize(input: DataInput2, available: Int): A

Deserializes and returns the content of the given DataInput2.

deserializeFromLong open fun deserializeFromLong(input: Long, available: Int): A

Deserializes and returns the content of the given long.

fixedSize open fun fixedSize(): Int

Returns the fixed size of the serialized form in bytes or -1 if the size is not fixed (e.g. for Strings).

Some optimizations can be applied to serializers with a fixed size.

isTrusted open fun isTrusted(): Boolean

Returns if this Serializer is trusted to always read the same number of bytes as it writes for any given object being serialized/de-serialized.

MapDB has a relaxed record size boundary checking. It expects deserializers to read exactly as many bytes as were written during serialization. If a deserializer reads more bytes than it wrote, 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 a store, but we must copy them into separate byte[] buffers. Thus, zero-copy optimizations are disabled by default, but can be explicitly enabled here by letting this method return true.

This flag indicates if this serializer was 'verified' to read as many bytes as it writes. It should also be much better tested etc.

needsAvailableSizeHint open fun needsAvailableSizeHint(): Boolean

TODO: Document this method

Inheritors

GroupSerializerObjectArray abstract class GroupSerializerObjectArray<A : Any> : GroupSerializer<A>

Created by jan on 2/29/16.

SerializerArrayTuple open class SerializerArrayTuple : GroupSerializer<Array<Any>>

Serializer for tuples. It serializes fixed size array, where each array index can use different serializer. It takes array of serializes in constructor parameter. All tuples (arrays) must have the same size.

SerializerBoolean open class SerializerBoolean : GroupSerializer<Boolean>

Created by jan on 2/28/16.

SerializerByteArray open class SerializerByteArray : GroupSerializer<ByteArray>

Created by jan on 2/28/16.

SerializerByteArrayDelta2 open class SerializerByteArrayDelta2 : GroupSerializer<ByteArray>

Created by jan on 2/29/16.

SerializerCompressionDeflateWrapper class SerializerCompressionDeflateWrapper<E : Any> : GroupSerializer<E>, Serializable

wraps another serializer and (de)compresses its output/input using Deflate

SerializerCompressionWrapper class SerializerCompressionWrapper<E : Any> : GroupSerializer<E>, Serializable

wraps another serializer and (de)compresses its output/input

SerializerEightByte abstract class SerializerEightByte<E : Any> : GroupSerializer<E>
SerializerFourByte abstract class SerializerFourByte<E : Any> : GroupSerializer<E>

Created by jan on 2/28/16.

SerializerString open class SerializerString : GroupSerializer<String>
SerializerStringDelta2 open class SerializerStringDelta2 : GroupSerializer<String>

Created by jan on 2/29/16.

SerializerUUID open class SerializerUUID : GroupSerializer<UUID>

Created by jan on 2/28/16.