java.lang.Object
org.apache.arrow.memory.util.MemoryUtil
Utilities for memory related operations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanIf the native byte order is little-endian. -
Method Summary
Modifier and TypeMethodDescriptionstatic longallocateMemory(long bytes) static voidcopyFromMemory(long srcAddress, byte[] dest, long destIndex, long bytes) static voidcopyMemory(long srcAddress, long destAddress, long bytes) static voidcopyToMemory(byte[] src, long srcIndex, long destAddress, long bytes) static ByteBufferdirectBuffer(long address, int capacity) Create nio byte buffer.static voidfreeMemory(long address) static bytegetByte(long address) static longGiven aByteBuffer, gets the address the underlying memory space.static intgetInt(byte[] bytes, int index) static intgetInt(long address) static longgetLong(byte[] bytes, int index) static longgetLong(long address) static shortgetShort(long address) static voidputByte(long address, byte value) static voidputInt(long address, int value) static voidputLong(long address, long value) static voidputShort(long address, short value) static voidsetMemory(long address, long bytes, byte value)
-
Field Details
-
LITTLE_ENDIAN
public static final boolean LITTLE_ENDIANIf the native byte order is little-endian.
-
-
Method Details
-
getByteBufferAddress
Given aByteBuffer, gets the address the underlying memory space.- Parameters:
buf- the byte buffer.- Returns:
- address of the underlying memory.
-
directBuffer
Create nio byte buffer. -
copyMemory
public static void copyMemory(long srcAddress, long destAddress, long bytes) -
copyToMemory
public static void copyToMemory(byte[] src, long srcIndex, long destAddress, long bytes) -
copyFromMemory
public static void copyFromMemory(long srcAddress, byte[] dest, long destIndex, long bytes) -
getByte
public static byte getByte(long address) -
putByte
public static void putByte(long address, byte value) -
getShort
public static short getShort(long address) -
putShort
public static void putShort(long address, short value) -
getInt
public static int getInt(long address) -
putInt
public static void putInt(long address, int value) -
getLong
public static long getLong(long address) -
putLong
public static void putLong(long address, long value) -
setMemory
public static void setMemory(long address, long bytes, byte value) -
getInt
public static int getInt(byte[] bytes, int index) -
getLong
public static long getLong(byte[] bytes, int index) -
allocateMemory
public static long allocateMemory(long bytes) -
freeMemory
public static void freeMemory(long address)
-