org.mapdb
Class BTreeKeySerializer.Tuple2KeySerializer<A,B>
java.lang.Object
org.mapdb.BTreeKeySerializer<Fun.Tuple2<A,B>>
org.mapdb.BTreeKeySerializer.Tuple2KeySerializer<A,B>
- Type Parameters:
A - first tuple valueB - second tuple value
- All Implemented Interfaces:
- Serializable
- Enclosing class:
- BTreeKeySerializer<K>
public static final class BTreeKeySerializer.Tuple2KeySerializer<A,B>
- extends BTreeKeySerializer<Fun.Tuple2<A,B>>
- implements Serializable
Applies delta compression on array of tuple. First tuple value may be shared between consequentive tuples, so only
first occurrence is serialized. An example:
Value Serialized as
-------------------------
Tuple(1, 1) 1, 1
Tuple(1, 2) 2
Tuple(1, 3) 3
Tuple(1, 4) 4
- See Also:
- Serialized Form
| 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> |
aComparator
protected final Comparator<A> aComparator
aSerializer
protected final Serializer<A> aSerializer
bSerializer
protected final Serializer<B> bSerializer
BTreeKeySerializer.Tuple2KeySerializer
public BTreeKeySerializer.Tuple2KeySerializer(Comparator<A> aComparator,
Serializer<A> aSerializer,
Serializer<B> bSerializer)
- Construct new Tuple2 Key Serializer. You may pass null for some value,
In that case 'default' value will be used, Comparable comparator and Default Serializer from DB.
- Parameters:
aComparator - comparator used for first tuple valueaSerializer - serializer used for first tuple valuebSerializer - serializer used for second tuple value
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<Fun.Tuple2<A,B>>
- Parameters:
out - output stream where to put atastart - where data start in array. Before this index all keys are nullend - where data ends in array (exclusive). From this index all keys are nullkeys - 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<Fun.Tuple2<A,B>>
- Parameters:
in - input stream to read data fromstart - where data start in array. Before this index all keys are nullend - where data ends in array (exclusive). From this index all keys are nullsize - size of array which should be returned
- Returns:
- array of keys for single BTree Node
- Throws:
IOException
getComparator
public Comparator<Fun.Tuple2<A,B>> 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<Fun.Tuple2<A,B>>
- Returns:
- comparator which must be used with this method. `null` if comparator is not strictly required.
equals
public boolean equals(Object o)
- Overrides:
equals in class Object
hashCode
public int hashCode()
- Overrides:
hashCode in class Object
Copyright © 2014. All Rights Reserved.