java.lang.Object
org.apache.arrow.c.NativeUtil
Utility functions for working with native memory.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic long
addressOrNull
(BaseStruct struct) Get the address of a C Data Interface struct or 0x0 if the input struct is null.static long
addressOrNull
(ArrowBuf buf) Get the address of a buffer or 0x0 if the input buffer is null.static void
closeBuffer
(ArrowBuf buf) Close a buffer if it's not null.static long[]
toJavaArray
(long arrayPtr, int size) Convert a native array pointer (void**) to Java array of pointers.static String
toJavaString
(long cstringPtr) Convert a pointer to a null terminated string into a Java String.static ArrowBuf
toNativeString
(BufferAllocator allocator, String string) Convert Java string to a null terminated string.
-
Field Details
-
NULL
public static final byte NULL- See Also:
-
-
Method Details
-
toJavaString
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 pointersize
- Array size- Returns:
- Array of pointer values as longs
-
toNativeString
Convert Java string to a null terminated string.- Parameters:
allocator
- Buffer allocator for allocating the native stringstring
- Input String to convert- Returns:
- Buffer with a null terminated string or null if the input is null
-
closeBuffer
Close a buffer if it's not null.- Parameters:
buf
- Buffer to close
-
addressOrNull
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
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
-