Package org.apache.druid.segment.data
Class SafeWritableBase
java.lang.Object
org.apache.druid.segment.data.SafeWritableBase
- All Implemented Interfaces:
org.apache.datasketches.memory.BaseState
- Direct Known Subclasses:
SafeWritableBuffer,SafeWritableMemory
public abstract class SafeWritableBase
extends Object
implements org.apache.datasketches.memory.BaseState
Base class for making a regular
ByteBuffer look like a Memory or
Buffer. All methods delegate directly to the ByteBuffer rather
than using 'unsafe' reads.- See Also:
-
Field Summary
Fields inherited from interface org.apache.datasketches.memory.BaseState
defaultMemReqSvr -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckValidAndBounds(long offsetBytes, long lengthBytes) booleangetBoolean(long offsetBytes) bytegetByte(long offsetBytes) longchargetChar(long offsetBytes) longlonggetCumulativeOffset(long offsetBytes) doublegetDouble(long offsetBytes) floatgetFloat(long offsetBytes) intgetInt(long offsetBytes) longgetLong(long offsetBytes) org.apache.datasketches.memory.MemoryRequestServerlonglonggetRegionOffset(long offsetBytes) shortgetShort(long offsetBytes) booleanhasArray()booleanbooleanisByteOrderCompatible(ByteOrder byteOrder) booleanisDirect()booleanbooleanisSameResource(Object that) booleanisValid()voidputBoolean(long offsetBytes, boolean value) voidputByte(long offsetBytes, byte value) voidputChar(long offsetBytes, char value) voidputDouble(long offsetBytes, double value) voidputFloat(long offsetBytes, float value) voidputInt(long offsetBytes, int value) voidputLong(long offsetBytes, long value) voidputShort(long offsetBytes, short value) toHexString(String header, long offsetBytes, int lengthBytes) Adapted fromBaseStateImpl.toHexString(String, long, int)longxxHash64(long in, long seed) longxxHash64(long offsetBytes, long lengthBytes, long seed) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.datasketches.memory.BaseState
equals, equalTo, hashCode
-
Constructor Details
-
SafeWritableBase
-
-
Method Details
-
getMemoryRequestServer
public org.apache.datasketches.memory.MemoryRequestServer getMemoryRequestServer() -
getBoolean
public boolean getBoolean(long offsetBytes) -
getByte
public byte getByte(long offsetBytes) -
getChar
public char getChar(long offsetBytes) -
getDouble
public double getDouble(long offsetBytes) -
getFloat
public float getFloat(long offsetBytes) -
getInt
public int getInt(long offsetBytes) -
getLong
public long getLong(long offsetBytes) -
getShort
public short getShort(long offsetBytes) -
putBoolean
public void putBoolean(long offsetBytes, boolean value) -
putByte
public void putByte(long offsetBytes, byte value) -
putChar
public void putChar(long offsetBytes, char value) -
putDouble
public void putDouble(long offsetBytes, double value) -
putFloat
public void putFloat(long offsetBytes, float value) -
putInt
public void putInt(long offsetBytes, int value) -
putLong
public void putLong(long offsetBytes, long value) -
putShort
public void putShort(long offsetBytes, short value) -
getTypeByteOrder
- Specified by:
getTypeByteOrderin interfaceorg.apache.datasketches.memory.BaseState
-
isByteOrderCompatible
- Specified by:
isByteOrderCompatiblein interfaceorg.apache.datasketches.memory.BaseState
-
getByteBuffer
- Specified by:
getByteBufferin interfaceorg.apache.datasketches.memory.BaseState
-
getCapacity
public long getCapacity()- Specified by:
getCapacityin interfaceorg.apache.datasketches.memory.BaseState
-
getCumulativeOffset
public long getCumulativeOffset()- Specified by:
getCumulativeOffsetin interfaceorg.apache.datasketches.memory.BaseState
-
getCumulativeOffset
public long getCumulativeOffset(long offsetBytes) - Specified by:
getCumulativeOffsetin interfaceorg.apache.datasketches.memory.BaseState
-
getRegionOffset
public long getRegionOffset()- Specified by:
getRegionOffsetin interfaceorg.apache.datasketches.memory.BaseState
-
getRegionOffset
public long getRegionOffset(long offsetBytes) - Specified by:
getRegionOffsetin interfaceorg.apache.datasketches.memory.BaseState
-
hasArray
public boolean hasArray()- Specified by:
hasArrayin interfaceorg.apache.datasketches.memory.BaseState
-
xxHash64
public long xxHash64(long offsetBytes, long lengthBytes, long seed) - Specified by:
xxHash64in interfaceorg.apache.datasketches.memory.BaseState
-
xxHash64
public long xxHash64(long in, long seed) - Specified by:
xxHash64in interfaceorg.apache.datasketches.memory.BaseState
-
hasByteBuffer
public boolean hasByteBuffer()- Specified by:
hasByteBufferin interfaceorg.apache.datasketches.memory.BaseState
-
isDirect
public boolean isDirect()- Specified by:
isDirectin interfaceorg.apache.datasketches.memory.BaseState
-
isReadOnly
public boolean isReadOnly()- Specified by:
isReadOnlyin interfaceorg.apache.datasketches.memory.BaseState
-
isSameResource
- Specified by:
isSameResourcein interfaceorg.apache.datasketches.memory.BaseState
-
isValid
public boolean isValid()- Specified by:
isValidin interfaceorg.apache.datasketches.memory.BaseState
-
checkValidAndBounds
public void checkValidAndBounds(long offsetBytes, long lengthBytes) - Specified by:
checkValidAndBoundsin interfaceorg.apache.datasketches.memory.BaseState
-
toHexString
Adapted fromBaseStateImpl.toHexString(String, long, int)- Specified by:
toHexStringin interfaceorg.apache.datasketches.memory.BaseState
-