org.mapdb / Serializer / isTrusted

isTrusted

open fun isTrusted(): Boolean

Returns if this Serializer is trusted to always read the same number of bytes as it writes for any given object being serialized/de-serialized.

MapDB has a relaxed record size boundary checking. It expects deserializers to read exactly as many bytes as were written during serialization. If a deserializer reads more bytes than it wrote, it might start reading others record data in store.

Some serializers (Kryo) have problems with this. To prevent this, we can not read data directly from a store, but we must copy them into separate byte[] buffers. Thus, zero-copy optimizations are disabled by default, but can be explicitly enabled here by letting this method return true.

This flag indicates if this serializer was 'verified' to read as many bytes as it writes. It should also be much better tested etc.

Return
if this Serializer is trusted to always read the same number of bytes as it writes for any given object being serialized/de-serialized