Class SequenceLexicoder<E>
- java.lang.Object
-
- org.apache.accumulo.core.client.lexicoder.AbstractEncoder<T>
-
- org.apache.accumulo.core.clientImpl.lexicoder.AbstractLexicoder<List<E>>
-
- org.apache.accumulo.core.client.lexicoder.SequenceLexicoder<E>
-
- Type Parameters:
E
- list element type.
public class SequenceLexicoder<E> extends AbstractLexicoder<List<E>>
A Lexicoder to encode/decode a Java List to/from a byte array where the concatenation of each encoded element sorts lexicographically. Note: UnlikeListLexicoder
, this implementation supports empty lists. The lists are encoded with the elements separated by null (0x0) bytes, which null bytes appearing in the elements escaped as two 0x1 bytes, and 0x1 bytes appearing in the elements escaped as 0x1 and 0x2 bytes. The list is terminated with a final delimiter after the last element, with no bytes following it. An empty list is represented as an empty byte array, with no delimiter, whereas a list with a single empty element is represented as a single terminating delimiter.- Since:
- 2.0.0
-
-
Constructor Summary
Constructors Constructor Description SequenceLexicoder(Lexicoder<E> elementLexicoder)
Primary constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<E>
decodeUnchecked(byte[] b, int offset, int len)
Decodes a byte array without checking if the offset and len exceed the bounds of the actual array.byte[]
encode(List<E> v)
-
Methods inherited from class org.apache.accumulo.core.client.lexicoder.AbstractEncoder
decode, decode
-
-
-
-
Method Detail
-
encode
public byte[] encode(List<E> v)
- Returns:
- a byte array containing the concatenation of each element in the list encoded.
-
decodeUnchecked
protected List<E> decodeUnchecked(byte[] b, int offset, int len)
Description copied from class:AbstractEncoder
Decodes a byte array without checking if the offset and len exceed the bounds of the actual array.- Specified by:
decodeUnchecked
in classAbstractEncoder<List<E>>
-
-