public class MemoryUtil extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static ByteBuffer |
EMPTY_BYTE_BUFFER_DIRECT |
static sun.misc.Unsafe |
unsafe |
| 构造器和说明 |
|---|
MemoryUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static long |
allocate(long size) |
static ByteBuffer |
allocateDirect(int cap) |
static void |
copyMemory(long fromAddr,
long toAddr,
int count) |
static void |
copyMemory(Object src,
long srcOffset,
Object dst,
long dstOffset,
long length) |
static ByteBuffer |
duplicateDirectByteBuffer(ByteBuffer source) |
static ByteBuffer |
duplicateDirectByteBuffer(ByteBuffer source,
ByteBuffer hollowBuffer) |
static void |
free(ByteBuffer buffer)
Good manner to free a buffer before forget it.
|
static void |
free(long addr) |
static long |
getAddress(ByteBuffer buffer) |
static Object |
getAttachment(ByteBuffer instance) |
static FileChannel |
getBlockReaderLocal_dataIn(Object br) |
static boolean |
getBlockReaderLocal_verifyChecksum(Object br) |
static byte |
getByte(long address) |
static ByteBuffer |
getByteBuffer(long address,
int length,
boolean autoFree) |
static void |
getBytes(long address,
byte[] buffer,
int bufferOffset,
int count)
Transfers objCount bytes from Memory starting at memoryOffset to buffer starting at
bufferOffset
|
static int |
getCap(ByteBuffer buffer) |
static BigDecimal |
getDecimal128(long address,
int scale) |
static BigDecimal |
getDecimal256(long address,
int scale) |
static BigDecimal |
getDecimal32(long address,
int scale) |
static BigDecimal |
getDecimal64(long address,
int scale) |
static double |
getDouble(long address) |
static float |
getFloat(long address) |
static ByteBuffer |
getHollowDirectByteBuffer() |
static int |
getInt(long address) |
static int |
getIntByByte(long address) |
static long |
getLong(long address) |
static long |
getLongByByte(long address) |
static short |
getShort(long address) |
static int |
getShortByByte(long address) |
static char[] |
getStringValue(String str) |
static long |
getTotalPhysicalMemorySize() |
static int |
pageSize() |
static void |
putIntByByte(long address,
int value) |
static void |
putLongByByte(long address,
long value) |
static void |
readFully(ByteBuffer dst,
CodecDataInput cdi,
int length) |
static void |
setAttachment(ByteBuffer instance,
Object next) |
static void |
setBlockReaderLocal_verifyChecksum(Object br,
boolean value) |
static void |
setByte(long address,
byte b) |
static void |
setByteBuffer(ByteBuffer instance,
long address,
int length,
sun.misc.Cleaner cleaner) |
static void |
setBytes(byte[] src,
int offset,
long trg,
long count) |
static void |
setBytes(long address,
byte[] buffer,
int bufferOffset,
int count)
Transfers objCount bytes from buffer to Memory
|
static void |
setBytes(long address,
ByteBuffer buffer) |
static void |
setBytes(long src,
long trg,
long count) |
static void |
setDecimal(long address,
BigDecimal v,
int scale) |
static void |
setDecimal256(long address,
BigDecimal v,
int scale) |
static void |
setDouble(long address,
double v) |
static void |
setFloat(long address,
float v) |
static void |
setInt(long address,
int l) |
static void |
setLong(long address,
long l) |
static void |
setMemory(long addr,
long size,
byte v) |
static void |
setMemory(Object base,
long offset,
long size,
byte v) |
static void |
setShort(long address,
short s) |
public static final ByteBuffer EMPTY_BYTE_BUFFER_DIRECT
public static final sun.misc.Unsafe unsafe
public static boolean getBlockReaderLocal_verifyChecksum(Object br)
public static void setBlockReaderLocal_verifyChecksum(Object br, boolean value)
public static FileChannel getBlockReaderLocal_dataIn(Object br)
public static int pageSize()
public static void setMemory(long addr,
long size,
byte v)
public static void setMemory(Object base, long offset, long size, byte v)
public static long getAddress(ByteBuffer buffer)
public static int getCap(ByteBuffer buffer)
public static long allocate(long size)
public static void free(long addr)
public static void free(ByteBuffer buffer)
public static void setByte(long address,
byte b)
public static void setShort(long address,
short s)
public static void setInt(long address,
int l)
public static void setDecimal(long address,
BigDecimal v,
int scale)
public static void setDecimal256(long address,
BigDecimal v,
int scale)
public static void setLong(long address,
long l)
public static void setFloat(long address,
float v)
public static void setDouble(long address,
double v)
public static byte getByte(long address)
public static short getShort(long address)
public static int getInt(long address)
public static BigDecimal getDecimal32(long address, int scale)
public static BigDecimal getDecimal64(long address, int scale)
public static BigDecimal getDecimal128(long address, int scale)
public static BigDecimal getDecimal256(long address, int scale)
public static long getLong(long address)
public static float getFloat(long address)
public static double getDouble(long address)
public static ByteBuffer getByteBuffer(long address, int length, boolean autoFree)
public static ByteBuffer getHollowDirectByteBuffer()
public static void setByteBuffer(ByteBuffer instance, long address, int length, sun.misc.Cleaner cleaner)
public static Object getAttachment(ByteBuffer instance)
public static void setAttachment(ByteBuffer instance, Object next)
public static ByteBuffer duplicateDirectByteBuffer(ByteBuffer source, ByteBuffer hollowBuffer)
public static ByteBuffer duplicateDirectByteBuffer(ByteBuffer source)
public static long getLongByByte(long address)
public static int getIntByByte(long address)
public static int getShortByByte(long address)
public static void putLongByByte(long address,
long value)
public static void putIntByByte(long address,
int value)
public static void setBytes(long address,
ByteBuffer buffer)
public static void setBytes(long address,
byte[] buffer,
int bufferOffset,
int count)
address - start offset in the memorybuffer - the data bufferbufferOffset - start offset of the buffercount - number of bytes to transferpublic static void setBytes(long src,
long trg,
long count)
public static void setBytes(byte[] src,
int offset,
long trg,
long count)
public static void getBytes(long address,
byte[] buffer,
int bufferOffset,
int count)
address - start offset in the memorybuffer - the data bufferbufferOffset - start offset of the buffercount - number of bytes to transferpublic static char[] getStringValue(String str)
public static void copyMemory(long fromAddr,
long toAddr,
int count)
public static void copyMemory(Object src, long srcOffset, Object dst, long dstOffset, long length)
public static long getTotalPhysicalMemorySize()
public static ByteBuffer allocateDirect(int cap)
public static void readFully(ByteBuffer dst, CodecDataInput cdi, int length)
Copyright © 2022 PingCAP. All rights reserved.