Class MemoryUtil
- java.lang.Object
-
- org.apache.cassandra.utils.memory.MemoryUtil
-
public abstract class MemoryUtil extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static booleanINVERTED_ORDER
-
Constructor Summary
Constructors Constructor Description MemoryUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static longallocate(long size)static java.nio.ByteBufferduplicateDirectByteBuffer(java.nio.ByteBuffer source, java.nio.ByteBuffer hollowBuffer)static voidfree(long peer)static longgetAddress(java.nio.ByteBuffer buffer)static java.lang.ObjectgetAttachment(java.nio.ByteBuffer instance)static bytegetByte(long address)static java.nio.ByteBuffergetByteBuffer(long address, int length)static java.nio.ByteBuffergetByteBuffer(long address, int length, java.nio.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 java.nio.ByteBuffergetHollowByteBuffer()static java.nio.ByteBuffergetHollowDirectByteBuffer()static java.nio.ByteBuffergetHollowDirectByteBuffer(java.nio.ByteOrder order)static intgetInt(long address)static intgetIntByByte(long address)static longgetLong(long address)static longgetLongByByte(long address)static intgetShort(long address)static intgetShortByByte(long address)static booleanisExactlyDirect(java.nio.ByteBuffer buffer)static intpageSize()static voidputIntByByte(long address, int value)static voidputLongByByte(long address, long value)static voidsetAttachment(java.nio.ByteBuffer instance, java.lang.Object next)static voidsetByte(long address, byte b)static voidsetByte(long address, int count, byte b)static voidsetByteBufferCapacity(java.nio.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, java.nio.ByteBuffer buffer)static voidsetDirectByteBuffer(java.nio.ByteBuffer instance, long address, int length)static voidsetInt(long address, int l)static voidsetLong(long address, long l)static voidsetShort(long address, short s)static java.nio.ByteBuffersliceDirectByteBuffer(java.nio.ByteBuffer source, java.nio.ByteBuffer hollowBuffer, int offset, int length)
-
-
-
Method Detail
-
pageSize
public static int pageSize()
-
getAddress
public static long getAddress(java.nio.ByteBuffer buffer)
-
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)
-
setShort
public static void setShort(long address, short s)
-
setInt
public static void setInt(long address, int l)
-
setLong
public static void setLong(long address, long l)
-
getByte
public static byte getByte(long address)
-
getShort
public static int getShort(long address)
-
getInt
public static int getInt(long address)
-
getLong
public static long getLong(long address)
-
getByteBuffer
public static java.nio.ByteBuffer getByteBuffer(long address, int length)
-
getByteBuffer
public static java.nio.ByteBuffer getByteBuffer(long address, int length, java.nio.ByteOrder order)
-
getHollowDirectByteBuffer
public static java.nio.ByteBuffer getHollowDirectByteBuffer()
-
getHollowDirectByteBuffer
public static java.nio.ByteBuffer getHollowDirectByteBuffer(java.nio.ByteOrder order)
-
getHollowByteBuffer
public static java.nio.ByteBuffer getHollowByteBuffer()
-
isExactlyDirect
public static boolean isExactlyDirect(java.nio.ByteBuffer buffer)
-
getAttachment
public static java.lang.Object getAttachment(java.nio.ByteBuffer instance)
-
setAttachment
public static void setAttachment(java.nio.ByteBuffer instance, java.lang.Object next)
-
duplicateDirectByteBuffer
public static java.nio.ByteBuffer duplicateDirectByteBuffer(java.nio.ByteBuffer source, java.nio.ByteBuffer hollowBuffer)
-
sliceDirectByteBuffer
public static java.nio.ByteBuffer sliceDirectByteBuffer(java.nio.ByteBuffer source, java.nio.ByteBuffer hollowBuffer, int offset, int length)
-
setDirectByteBuffer
public static void setDirectByteBuffer(java.nio.ByteBuffer instance, long address, int length)
-
setByteBufferCapacity
public static void setByteBufferCapacity(java.nio.ByteBuffer instance, int capacity)
-
getLongByByte
public static long getLongByByte(long address)
-
getIntByByte
public static int getIntByByte(long address)
-
getShortByByte
public static int getShortByByte(long address)
-
putLongByByte
public static void putLongByByte(long address, long value)
-
putIntByByte
public static void putIntByByte(long address, int value)
-
setBytes
public static void setBytes(long address, java.nio.ByteBuffer buffer)
-
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
-
-