public class DefaultStateEncoder<K,V> extends Object implements StateEncoder<K,V,byte[],byte[]>
Default state encoder class for encoding/decoding key values. This class assumes encoded types of key and value are both binary (byte array) due to keep backward compatibility.
| Modifier and Type | Field and Description |
|---|---|
static Serializer<Optional<byte[]>> |
INTERNAL_VALUE_SERIALIZER |
static byte[] |
TOMBSTONE |
| Constructor and Description |
|---|
DefaultStateEncoder(Serializer<K> keySerializer,
Serializer<V> valueSerializer) |
| Modifier and Type | Method and Description |
|---|---|
K |
decodeKey(byte[] encodedKey)
Decode key.
|
V |
decodeValue(byte[] encodedValue)
Decode value.
|
byte[] |
encodeKey(K key)
Encode key.
|
byte[] |
encodeValue(V value)
Encode value.
|
Serializer<K> |
getKeySerializer() |
byte[] |
getTombstoneValue()
Get the tombstone value (deletion mark).
|
Serializer<V> |
getValueSerializer() |
public static final Serializer<Optional<byte[]>> INTERNAL_VALUE_SERIALIZER
public static final byte[] TOMBSTONE
public DefaultStateEncoder(Serializer<K> keySerializer, Serializer<V> valueSerializer)
public Serializer<K> getKeySerializer()
public Serializer<V> getValueSerializer()
public byte[] encodeKey(K key)
StateEncoderEncode key.
encodeKey in interface StateEncoder<K,V,byte[],byte[]>key - the value of key (K type)public byte[] encodeValue(V value)
StateEncoderEncode value.
encodeValue in interface StateEncoder<K,V,byte[],byte[]>value - the value of value (V type)public K decodeKey(byte[] encodedKey)
StateEncoderDecode key.
decodeKey in interface StateEncoder<K,V,byte[],byte[]>encodedKey - the value of key (KRAW type)public V decodeValue(byte[] encodedValue)
StateEncoderDecode value.
decodeValue in interface StateEncoder<K,V,byte[],byte[]>encodedValue - the value of key (VENCODEDT type)public byte[] getTombstoneValue()
StateEncoderGet the tombstone value (deletion mark).
getTombstoneValue in interface StateEncoder<K,V,byte[],byte[]>Copyright © 2021 The Apache Software Foundation. All rights reserved.