public interface CacheSerializer<T>
ByteBuffer
Modifier and Type | Method and Description |
---|---|
T |
deserialize(ByteBuffer buf)
Deserialize from the specified
DataInput instance. |
void |
serialize(T value,
ByteBuffer buf)
Serialize the specified type into the specified
ByteBuffer instance. |
int |
serializedSize(T value)
Calculate the number of bytes that will be produced by
serialize(Object, java.nio.ByteBuffer)
for given object t . |
void serialize(T value, ByteBuffer buf)
ByteBuffer
instance.value
- non-null
object that needs to be serializedbuf
- ByteBuffer
into which serialization needs to happen.T deserialize(ByteBuffer buf)
DataInput
instance.
Implementations of this method should never return null
. Although there might be
no explicit runtime checks, a violation would break the contract of several API methods in
OHCache
. For example users of OHCache.get(Object)
might not be able to distinguish
between a non-existing entry or the "value" null
. Instead, consider returning a singleton
replacement object.
buf
- ByteBuffer
from which deserialization needs to happen.null
.int serializedSize(T value)
serialize(Object, java.nio.ByteBuffer)
for given object t
.value
- non-null
object to calculate serialized size fort
Copyright © 2014–2017 Robert Stupp, Koeln, Germany, robert-stupp.de. All rights reserved.