K - The type of the keys in the map.V - The type of the values in the map.public final class SortedMapSerializer<K,V>
extends org.apache.flink.api.common.typeutils.TypeSerializer<M>
SortedMap. The serializer relies on a key serializer and a value
serializer for the serialization of the map's key-value pairs. It also deploys a comparator to
ensure the order of the keys.
The serialization format for the map is as follows: four bytes for the length of the map, followed by the serialized representation of each key-value pair. To allow null values, each value is prefixed by a null flag.
| Constructor and Description |
|---|
SortedMapSerializer(Comparator<K> comparator,
org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer,
org.apache.flink.api.common.typeutils.TypeSerializer<V> valueSerializer)
Constructor with given comparator, and the serializers for the keys and values in the map.
|
| Modifier and Type | Method and Description |
|---|---|
void |
copy(org.apache.flink.core.memory.DataInputView source,
org.apache.flink.core.memory.DataOutputView target) |
M |
copy(M from) |
M |
copy(M from,
M reuse) |
SortedMap<K,V> |
createInstance() |
M |
deserialize(org.apache.flink.core.memory.DataInputView source) |
M |
deserialize(M reuse,
org.apache.flink.core.memory.DataInputView source) |
org.apache.flink.api.common.typeutils.TypeSerializer<SortedMap<K,V>> |
duplicate() |
boolean |
equals(Object o) |
Comparator<K> |
getComparator()
Returns the comparator for the keys in the map.
|
org.apache.flink.api.common.typeutils.TypeSerializer<K> |
getKeySerializer()
Returns the serializer for the keys in the map.
|
int |
getLength() |
org.apache.flink.api.common.typeutils.TypeSerializer<V> |
getValueSerializer()
Returns the serializer for the values in the map.
|
int |
hashCode() |
boolean |
isImmutableType() |
void |
serialize(M map,
org.apache.flink.core.memory.DataOutputView target) |
org.apache.flink.api.common.typeutils.TypeSerializerSnapshot<SortedMap<K,V>> |
snapshotConfiguration() |
String |
toString() |
public SortedMapSerializer(Comparator<K> comparator, org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, org.apache.flink.api.common.typeutils.TypeSerializer<V> valueSerializer)
comparator - The comparator for the keys in the map.keySerializer - The serializer for the keys in the map.valueSerializer - The serializer for the values in the map.public Comparator<K> getComparator()
public boolean equals(Object o)
public int hashCode()
public org.apache.flink.api.common.typeutils.TypeSerializerSnapshot<SortedMap<K,V>> snapshotConfiguration()
public org.apache.flink.api.common.typeutils.TypeSerializer<K> getKeySerializer()
public org.apache.flink.api.common.typeutils.TypeSerializer<V> getValueSerializer()
public boolean isImmutableType()
isImmutableType in class org.apache.flink.api.common.typeutils.TypeSerializer<M extends Map<K,V>>public M copy(M from)
copy in class org.apache.flink.api.common.typeutils.TypeSerializer<M extends Map<K,V>>public M copy(M from,
M reuse)
copy in class org.apache.flink.api.common.typeutils.TypeSerializer<M extends Map<K,V>>public int getLength()
getLength in class org.apache.flink.api.common.typeutils.TypeSerializer<M extends Map<K,V>>public void serialize(M map,
org.apache.flink.core.memory.DataOutputView target)
throws IOException
serialize in class org.apache.flink.api.common.typeutils.TypeSerializer<M extends Map<K,V>>IOExceptionpublic M deserialize(org.apache.flink.core.memory.DataInputView source)
throws IOException
deserialize in class org.apache.flink.api.common.typeutils.TypeSerializer<M extends Map<K,V>>IOExceptionpublic M deserialize(M reuse,
org.apache.flink.core.memory.DataInputView source)
throws IOException
deserialize in class org.apache.flink.api.common.typeutils.TypeSerializer<M extends Map<K,V>>IOExceptionpublic void copy(org.apache.flink.core.memory.DataInputView source,
org.apache.flink.core.memory.DataOutputView target)
throws IOException
copy in class org.apache.flink.api.common.typeutils.TypeSerializer<M extends Map<K,V>>IOExceptionCopyright © 2014–2025 The Apache Software Foundation. All rights reserved.