public static class BenchmarkUtils.KeySerializer extends Object implements CacheSerializer<Long>
Constructor and Description |
---|
KeySerializer(int keyLen) |
Modifier and Type | Method and Description |
---|---|
Long |
deserialize(ByteBuffer buf)
Deserialize from the specified
DataInput instance. |
void |
serialize(Long val,
ByteBuffer buf)
Serialize the specified type into the specified
ByteBuffer instance. |
int |
serializedSize(Long value)
Calculate the number of bytes that will be produced by
CacheSerializer.serialize(Object, java.nio.ByteBuffer)
for given object t . |
public void serialize(Long val, ByteBuffer buf)
CacheSerializer
ByteBuffer
instance.serialize
in interface CacheSerializer<Long>
val
- non-null
object that needs to be serializedbuf
- ByteBuffer
into which serialization needs to happen.public Long deserialize(ByteBuffer buf)
CacheSerializer
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.
deserialize
in interface CacheSerializer<Long>
buf
- ByteBuffer
from which deserialization needs to happen.null
.public int serializedSize(Long value)
CacheSerializer
CacheSerializer.serialize(Object, java.nio.ByteBuffer)
for given object t
.serializedSize
in interface CacheSerializer<Long>
value
- non-null
object to calculate serialized size fort
Copyright © 2014–2019 Robert Stupp, Koeln, Germany, robert-stupp.de. All rights reserved.