Class MemoryUtil
java.lang.Object
org.apache.cassandra.utils.memory.MemoryUtil
- Direct Known Subclasses:
LittleEndianMemoryUtil,NativeEndianMemoryUtil
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Class<?>protected static final sun.misc.Unsafe -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longallocate(long size) static ByteBufferduplicateDirectByteBuffer(ByteBuffer source, ByteBuffer hollowBuffer) static voidfree(long peer) static longgetAddress(ByteBuffer buffer) static ObjectgetAttachment(ByteBuffer instance) static bytegetByte(long address) static ByteBuffergetByteBuffer(long address, int length) static ByteBuffergetByteBuffer(long address, int length, ByteOrder order) static voidgetBytes(long address, byte[] buffer, int bufferOffset, int count) Transfers count bytes from Memory starting at memoryOffset to buffer starting at bufferOffsetstatic ByteBufferstatic ByteBufferstatic booleanisExactlyDirect(ByteBuffer buffer) static intpageSize()static voidsetAttachment(ByteBuffer instance, Object next) static voidsetByte(long address, byte b) static voidsetByte(long address, int count, byte b) static voidsetByteBufferCapacity(ByteBuffer instance, int capacity) static voidsetBytes(byte[] src, int offset, long trg, long count) static voidsetBytes(long address, byte[] buffer, int bufferOffset, int count) Transfers count bytes from buffer to Memorystatic voidsetBytes(long src, long trg, long count) static voidsetBytes(long address, ByteBuffer buffer) static voidsetDirectByteBuffer(ByteBuffer instance, long address, int length) static ByteBuffersliceDirectByteBuffer(ByteBuffer source, ByteBuffer hollowBuffer, int offset, int length)
-
Field Details
-
unsafe
protected static final sun.misc.Unsafe unsafe -
BYTE_BUFFER_CLASS
-
-
Constructor Details
-
MemoryUtil
public MemoryUtil()
-
-
Method Details
-
pageSize
public static int pageSize() -
getAddress
-
allocate
public static long allocate(long size) -
free
public static void free(long peer) -
setByte
public static void setByte(long address, byte b) -
setByte
public static void setByte(long address, int count, byte b) -
getByte
public static byte getByte(long address) -
getByteBuffer
-
getByteBuffer
-
getHollowDirectByteBuffer
-
getHollowDirectByteBuffer
-
isExactlyDirect
-
getAttachment
-
setAttachment
-
duplicateDirectByteBuffer
-
sliceDirectByteBuffer
public static ByteBuffer sliceDirectByteBuffer(ByteBuffer source, ByteBuffer hollowBuffer, int offset, int length) -
setDirectByteBuffer
-
setByteBufferCapacity
-
setBytes
-
setBytes
public static void setBytes(long address, byte[] buffer, int bufferOffset, int count) Transfers count bytes from buffer to Memory- Parameters:
address- start offset in the memorybuffer- the data bufferbufferOffset- start offset of the buffercount- number of bytes to transfer
-
setBytes
public static void setBytes(long src, long trg, long count) -
setBytes
public static void setBytes(byte[] src, int offset, long trg, long count) -
getBytes
public static void getBytes(long address, byte[] buffer, int bufferOffset, int count) Transfers count bytes from Memory starting at memoryOffset to buffer starting at bufferOffset- Parameters:
address- start offset in the memorybuffer- the data bufferbufferOffset- start offset of the buffercount- number of bytes to transfer
-