java.lang.Object
org.apache.arrow.memory.util.MemoryUtil

public class MemoryUtil extends Object
Utilities for memory related operations.
  • Field Details

    • LITTLE_ENDIAN

      public static final boolean LITTLE_ENDIAN
      If the native byte order is little-endian.
  • Method Details

    • getByteBufferAddress

      public static long getByteBufferAddress(ByteBuffer buf)
      Given a ByteBuffer, gets the address the underlying memory space.
      Parameters:
      buf - the byte buffer.
      Returns:
      address of the underlying memory.
    • directBuffer

      public static ByteBuffer directBuffer(long address, int capacity)
      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)