K- the key type of serialized Maps
V- the value type of serialized Maps
public final class MapMarshaller<K,V> extends Object implements BytesReader<Map<K,V>>, BytesWriter<Map<K,V>>, StatefulCopyable<MapMarshaller<K,V>>
Map<K, V>. Uses
HashMap(hence default key objects' equality and
hashCode()as the map implementation to deserialize into.
This marshaller supports multimap emulation on top of Chronicle Map, that is possible but inefficient. See the README section.
Look for pre-defined key and value marshallers in
net.openhft.chronicle.hash.serialization.impl package. This package is not included into
Javadocs, but present in Chronicle Map distribution. If there are no existing marshallers for
Map key or value types, define
|Constructor and Description|
|Modifier and Type||Method and Description|
Creates a copy of this marshaller, with independent state.
Reads and returns the object from
Serializes the given object to the given
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
$equals, $fieldInfos, $hashCode, $toString, copyFrom, deepCopy, fromFile, fromFile, fromFileAsMap, fromFileAsMap, fromHexString, fromString, getField, mergeToMap, setField
public MapMarshaller(BytesReader<K> keyReader, BytesWriter<? super K> keyWriter, BytesReader<V> valueReader, BytesWriter<? super V> valueWriter)
MapMarshallerwith the given map keys' and values' serializers.
keyReader- map keys' reader
keyWriter- map keys' writer
valueReader- map values' reader
valueWriter- map values' writer
RandomCommon.readPosition()(i. e. the current position) in the given
in. Should attempt to reuse the given
usingobject, i. e. to read the deserialized data into the given object. If it is possible, this object then returned from this method back. If it is impossible for any reason, a new object should be created and returned. The given
usingobject could be
null, in this case this method, of cause, should create a new object.
This method should increment the position in the given
Bytes, i. e. consume the
in bytes shouldn't be written.
Implementation of this method should increment the position of the given
out by the number of bytes written. The given object should be
written into these range between the initial
bytes' position and the position after
this method call returns. Bytes outside of this range shouldn't be written. Any bytes
shouldn't be read from
public MapMarshaller<K,V> copy()
copy()is called, should be inherited in the copy (e. g. the class of objects serialized). So,
copy()should be transitive, i. e.
marshaller.copy().copy()should result to identical instances.
The state of the instance on which
copy() is called shouldn't be changed.
If some marshaller is ought to implement
StatefulCopyable interface (e. g.
DataAccess) but is stateless actually, it could return
this from this method.
public void readMarshallable(@NotNull WireIn wireIn)
Copyright © 2017. All rights reserved.