Package com.apple.foundationdb.tuple
Class TupleOrdering
java.lang.Object
com.apple.foundationdb.tuple.TupleOrdering
Helper methods for encoding
Tuple
s in ways that implement SQL-like ordering.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
pack
(Tuple tuple, TupleOrdering.Direction direction) Encode the given tuple in a way that unordered byte comparison respects the given direction.static Tuple
unpack
(byte[] packed, TupleOrdering.Direction direction) Decode the result ofpack(com.apple.foundationdb.tuple.Tuple, com.apple.foundationdb.tuple.TupleOrdering.Direction)
, recovering the original tuple.
-
Method Details
-
pack
@Nonnull public static byte[] pack(@Nonnull Tuple tuple, @Nonnull TupleOrdering.Direction direction) Encode the given tuple in a way that unordered byte comparison respects the given direction.- Parameters:
tuple
- tuple to encodedirection
- direction of desired ordering- Returns:
- a byte string that compares properly
-
unpack
@Nonnull public static Tuple unpack(@Nonnull byte[] packed, @Nonnull TupleOrdering.Direction direction) Decode the result ofpack(com.apple.foundationdb.tuple.Tuple, com.apple.foundationdb.tuple.TupleOrdering.Direction)
, recovering the original tuple.- Parameters:
packed
- comparable byte string encodingdirection
- direction used by encoding- Returns:
- tuple that would encode that way
-