Modifier and Type | Method and Description |
---|---|
Grouper.KeyComparator |
bufferComparator()
Return an object that knows how to compare two serialized keys.
|
T |
fromByteBuffer(ByteBuffer buffer,
int position)
Deserialize a key from a buffer.
|
Class<T> |
keyClazz()
Class of the keys.
|
int |
keySize()
Size of the keys returned by
toByteBuffer(Object) (which must be a fixed size) |
void |
reset()
Reset the keySerde to its initial state.
|
ByteBuffer |
toByteBuffer(T key)
Serialize a key.
|
int keySize()
toByteBuffer(Object)
(which must be a fixed size)ByteBuffer toByteBuffer(T key)
#aggregate(Comparable)
method. The buffer will not
be retained after the aggregate method returns, so reusing buffers is OK.
This method may return null, which indicates that some internal resource limit has been reached and
no more keys can be generated. In this situation you can call reset()
and try again, although
beware the caveats on that method.
key
- key objectT fromByteBuffer(ByteBuffer buffer, int position)
Grouper.iterator(boolean)
method.buffer
- buffer containing the keyposition
- key start position in the bufferGrouper.KeyComparator bufferComparator()
Grouper.iterator(boolean)
method if sorting is enabled.void reset()
fromByteBuffer(ByteBuffer, int)
and bufferComparator()
may no longer work properly on previously-serialized keys.Copyright © 2011–2017. All rights reserved.