Package org.apache.druid.segment.data
Class DecompressingByteBufferObjectStrategy
- java.lang.Object
-
- org.apache.druid.segment.data.DecompressingByteBufferObjectStrategy
-
- All Implemented Interfaces:
Comparator<ResourceHolder<ByteBuffer>>
,ObjectStrategy<ResourceHolder<ByteBuffer>>
public class DecompressingByteBufferObjectStrategy extends Object implements ObjectStrategy<ResourceHolder<ByteBuffer>>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canCompare()
WhetherComparator.compare(T, T)
is valid or not.int
compare(ResourceHolder<ByteBuffer> o1, ResourceHolder<ByteBuffer> o2)
ResourceHolder<ByteBuffer>
fromByteBuffer(ByteBuffer buffer, int numBytes)
Convert values from their underlying byte representation.Class<ResourceHolder<ByteBuffer>>
getClazz()
static DecompressingByteBufferObjectStrategy
of(ByteOrder order, CompressionStrategy compression)
byte[]
toBytes(ResourceHolder<ByteBuffer> holder)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Methods inherited from interface org.apache.druid.segment.data.ObjectStrategy
fromByteBufferSafe, fromByteBufferWithSize, writeTo
-
-
-
-
Method Detail
-
of
public static DecompressingByteBufferObjectStrategy of(ByteOrder order, CompressionStrategy compression)
-
getClazz
public Class<ResourceHolder<ByteBuffer>> getClazz()
- Specified by:
getClazz
in interfaceObjectStrategy<ResourceHolder<ByteBuffer>>
-
fromByteBuffer
public ResourceHolder<ByteBuffer> fromByteBuffer(ByteBuffer buffer, int numBytes)
Description copied from interface:ObjectStrategy
Convert values from their underlying byte representation. Implementations of this method may change the given buffer's mark, or limit, and position. Implementations of this method may not store the given buffer in a field of the "deserialized" object, need to useByteBuffer.slice()
,ByteBuffer.asReadOnlyBuffer()
orByteBuffer.duplicate()
in this case.- Specified by:
fromByteBuffer
in interfaceObjectStrategy<ResourceHolder<ByteBuffer>>
- Parameters:
buffer
- buffer to read value fromnumBytes
- number of bytes used to store the value, starting at buffer.position()- Returns:
- an object created from the given byte buffer representation
-
canCompare
public boolean canCompare()
Description copied from interface:ObjectStrategy
WhetherComparator.compare(T, T)
is valid or not.- Specified by:
canCompare
in interfaceObjectStrategy<ResourceHolder<ByteBuffer>>
-
compare
public int compare(ResourceHolder<ByteBuffer> o1, ResourceHolder<ByteBuffer> o2)
- Specified by:
compare
in interfaceComparator<ResourceHolder<ByteBuffer>>
-
toBytes
public byte[] toBytes(ResourceHolder<ByteBuffer> holder)
- Specified by:
toBytes
in interfaceObjectStrategy<ResourceHolder<ByteBuffer>>
-
-