org.mapdb
Class BTreeKeySerializer.BasicKeySerializer

java.lang.Object
  extended by org.mapdb.BTreeKeySerializer<Object>
      extended by org.mapdb.BTreeKeySerializer.BasicKeySerializer
All Implemented Interfaces:
Serializable
Enclosing class:
BTreeKeySerializer<K>

public static final class BTreeKeySerializer.BasicKeySerializer
extends BTreeKeySerializer<Object>
implements Serializable

Basic Key Serializer which just writes data without applying any compression. Is used by default if no other Key Serializer is specified.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.mapdb.BTreeKeySerializer
BTreeKeySerializer.BasicKeySerializer, BTreeKeySerializer.Tuple2KeySerializer<A,B>, BTreeKeySerializer.Tuple3KeySerializer<A,B,C>, BTreeKeySerializer.Tuple4KeySerializer<A,B,C,D>, BTreeKeySerializer.Tuple5KeySerializer<A,B,C,D,E>, BTreeKeySerializer.Tuple6KeySerializer<A,B,C,D,E,F>
 
Field Summary
protected  Serializer defaultSerializer
           
 
Fields inherited from class org.mapdb.BTreeKeySerializer
BASIC, STRING, TUPLE2, TUPLE3, TUPLE4, ZERO_OR_POSITIVE_INT, ZERO_OR_POSITIVE_LONG
 
Constructor Summary
  BTreeKeySerializer.BasicKeySerializer(Serializer defaultSerializer)
           
protected BTreeKeySerializer.BasicKeySerializer(SerializerBase serializerBase, DataInput is, SerializerBase.FastArrayList<Object> objectStack)
          used for deserialization
 
Method Summary
 Object[] deserialize(DataInput in, int start, int end, int size)
          Deserializes keys for single BTree Node.
 Comparator<Object> getComparator()
          Some key serializers may only work with they own comparators.
 void serialize(DataOutput out, int start, int end, Object[] keys)
          Serialize keys from single BTree Node.
 
Methods inherited from class org.mapdb.BTreeKeySerializer
leadingValuePackRead, leadingValuePackWrite
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultSerializer

protected final Serializer defaultSerializer
Constructor Detail

BTreeKeySerializer.BasicKeySerializer

public BTreeKeySerializer.BasicKeySerializer(Serializer defaultSerializer)

BTreeKeySerializer.BasicKeySerializer

protected BTreeKeySerializer.BasicKeySerializer(SerializerBase serializerBase,
                                                DataInput is,
                                                SerializerBase.FastArrayList<Object> objectStack)
                                         throws IOException
used for deserialization

Throws:
IOException
Method Detail

serialize

public void serialize(DataOutput out,
                      int start,
                      int end,
                      Object[] keys)
               throws IOException
Description copied from class: BTreeKeySerializer
Serialize keys from single BTree Node.

Specified by:
serialize in class BTreeKeySerializer<Object>
Parameters:
out - output stream where to put ata
start - where data start in array. Before this index all keys are null
end - where data ends in array (exclusive). From this index all keys are null
keys - array of keys for single BTree Node
Throws:
IOException

deserialize

public Object[] deserialize(DataInput in,
                            int start,
                            int end,
                            int size)
                     throws IOException
Description copied from class: BTreeKeySerializer
Deserializes keys for single BTree Node. To

Specified by:
deserialize in class BTreeKeySerializer<Object>
Parameters:
in - input stream to read data from
start - where data start in array. Before this index all keys are null
end - where data ends in array (exclusive). From this index all keys are null
size - size of array which should be returned
Returns:
array of keys for single BTree Node
Throws:
IOException

getComparator

public Comparator<Object> getComparator()
Description copied from class: BTreeKeySerializer
Some key serializers may only work with they own comparators. For example delta-packing stores increments between numbers and requires ascending order. So Key Serializer may provide its own comparator.

Specified by:
getComparator in class BTreeKeySerializer<Object>
Returns:
comparator which must be used with this method. `null` if comparator is not strictly required.


Copyright © 2014. All Rights Reserved.