Class NativeUtil

java.lang.Object
org.apache.arrow.c.NativeUtil

public final class NativeUtil extends Object
Utility functions for working with native memory.
  • Field Details

  • Method Details

    • toJavaString

      public static String toJavaString(long cstringPtr)
      Convert a pointer to a null terminated string into a Java String.
      Parameters:
      cstringPtr - pointer to C string
      Returns:
      Converted string
    • toJavaArray

      public static long[] toJavaArray(long arrayPtr, int size)
      Convert a native array pointer (void**) to Java array of pointers.
      Parameters:
      arrayPtr - Array pointer
      size - Array size
      Returns:
      Array of pointer values as longs
    • toNativeString

      public static ArrowBuf toNativeString(BufferAllocator allocator, String string)
      Convert Java string to a null terminated string.
      Parameters:
      allocator - Buffer allocator for allocating the native string
      string - Input String to convert
      Returns:
      Buffer with a null terminated string or null if the input is null
    • closeBuffer

      public static void closeBuffer(ArrowBuf buf)
      Close a buffer if it's not null.
      Parameters:
      buf - Buffer to close
    • addressOrNull

      public static long addressOrNull(ArrowBuf buf)
      Get the address of a buffer or 0x0 if the input buffer is null.
      Parameters:
      buf - Buffer to get the address of
      Returns:
      Memory address or 0x0
    • addressOrNull

      public static long addressOrNull(BaseStruct struct)
      Get the address of a C Data Interface struct or 0x0 if the input struct is null.
      Parameters:
      struct - C Data Interface struct to get the address of
      Returns:
      Memory address or 0x0