Class JniUtility
- Namespace
- easyar
JNI utility class. Used to wrap Java arrays and ByteBuffer in Unity. Not supported on iOS platform.
JniUtility
Methods
wrapByteArray
Wraps Java byte array byte[].
void easyar_JniUtility_wrapByteArray(void * bytes, bool readOnly, easyar_FunctorOfVoid deleter, easyar_Buffer * * Return)
static std::shared_ptr<Buffer> wrapByteArray(void * bytes, bool readOnly, std::function<void()> deleter)
public static @Nonnull Buffer wrapByteArray(long bytes, boolean readOnly, @Nonnull FunctorOfVoid deleter)
companion object fun wrapByteArray(bytes: Long, readOnly: Boolean, deleter: FunctorOfVoid): Buffer
+ (easyar_Buffer *)wrapByteArray:(void *)bytes readOnly:(bool)readOnly deleter:(void (^)())deleter
public static func wrapByteArray(_ bytes: OpaquePointer?, _ readOnly: Bool, _ deleter: @escaping () -> Void) -> Buffer
public static Buffer wrapByteArray(IntPtr bytes, bool readOnly, Action deleter)
Parameters
bytesIntPtrreadOnlyBooleandeleterAction
Returns
wrapBuffer
Wraps the direct buffer in Java's java.nio.ByteBuffer.
void easyar_JniUtility_wrapBuffer(void * directBuffer, easyar_FunctorOfVoid deleter, easyar_Buffer * * Return)
static std::shared_ptr<Buffer> wrapBuffer(void * directBuffer, std::function<void()> deleter)
public static @Nonnull Buffer wrapBuffer(long directBuffer, @Nonnull FunctorOfVoid deleter)
companion object fun wrapBuffer(directBuffer: Long, deleter: FunctorOfVoid): Buffer
+ (easyar_Buffer *)wrapBuffer:(void *)directBuffer deleter:(void (^)())deleter
public static func wrapBuffer(_ directBuffer: OpaquePointer?, _ deleter: @escaping () -> Void) -> Buffer
public static Buffer wrapBuffer(IntPtr directBuffer, Action deleter)
Parameters
directBufferIntPtrdeleterAction
Returns
getDirectBufferAddress
Calls JNIEnv->GetDirectBufferAddress to obtain the raw address of the direct buffer in java.nio.ByteBuffer.
void * easyar_JniUtility_getDirectBufferAddress(void * directBuffer)
static void * getDirectBufferAddress(void * directBuffer)
public static long getDirectBufferAddress(long directBuffer)
companion object fun getDirectBufferAddress(directBuffer: Long): Long
+ (void *)getDirectBufferAddress:(void *)directBuffer
public static func getDirectBufferAddress(_ directBuffer: OpaquePointer?) -> OpaquePointer?
public static IntPtr getDirectBufferAddress(IntPtr directBuffer)
Parameters
directBufferIntPtr
Returns
- IntPtr
newJniGlobalPointer
Obtains a global pointer to a Java object in JNI.
public static long Buffer newJniGlobalPointer(java.lang.@Nonnull Object obj)
companion object fun newJniGlobalPointer(obj: java.lang.Object): Long
Parameters
obj
Returns
deleteJniGlobalPointer
Releases the global pointer to a Java object in JNI.
public static long Buffer newJniGlobalPointer(java.lang.@Nonnull Object obj)
companion object fun newJniGlobalPointer(obj: java.lang.Object): Long
Parameters
obj