Class MemoryUtil
- java.lang.Object
-
- org.apache.cassandra.utils.memory.MemoryUtil
-
public abstract class MemoryUtil extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description MemoryUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
allocate(long size)
static java.nio.ByteBuffer
duplicateDirectByteBuffer(java.nio.ByteBuffer source, java.nio.ByteBuffer hollowBuffer)
static void
free(long peer)
static long
getAddress(java.nio.ByteBuffer buffer)
static java.lang.Object
getAttachment(java.nio.ByteBuffer instance)
static byte
getByte(long address)
static java.nio.ByteBuffer
getByteBuffer(long address, int length)
static java.nio.ByteBuffer
getByteBuffer(long address, int length, java.nio.ByteOrder order)
static void
getBytes(long address, byte[] buffer, int bufferOffset, int count)
Transfers count bytes from Memory starting at memoryOffset to buffer starting at bufferOffsetstatic java.nio.ByteBuffer
getHollowByteBuffer()
static java.nio.ByteBuffer
getHollowDirectByteBuffer()
static java.nio.ByteBuffer
getHollowDirectByteBuffer(java.nio.ByteOrder order)
static int
getInt(long address)
static int
getIntByByte(long address)
static long
getLong(long address)
static long
getLongByByte(long address)
static int
getShort(long address)
static int
getShortByByte(long address)
static boolean
isExactlyDirect(java.nio.ByteBuffer buffer)
static int
pageSize()
static void
putIntByByte(long address, int value)
static void
putLongByByte(long address, long value)
static void
setAttachment(java.nio.ByteBuffer instance, java.lang.Object next)
static void
setByte(long address, byte b)
static void
setByte(long address, int count, byte b)
static void
setByteBufferCapacity(java.nio.ByteBuffer instance, int capacity)
static void
setBytes(byte[] src, int offset, long trg, long count)
static void
setBytes(long address, byte[] buffer, int bufferOffset, int count)
Transfers count bytes from buffer to Memorystatic void
setBytes(long src, long trg, long count)
static void
setBytes(long address, java.nio.ByteBuffer buffer)
static void
setDirectByteBuffer(java.nio.ByteBuffer instance, long address, int length)
static void
setInt(long address, int l)
static void
setLong(long address, long l)
static void
setShort(long address, short s)
static java.nio.ByteBuffer
sliceDirectByteBuffer(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
-
-