JniUtility Class

Description

JNI工具类。

用于在Unity中对Java的数组和ByteBuffer进行包装。

不支持iOS平台。

wrapByteArray

包装Java的字节数组byte[]。

C: void easyar_JniUtility_wrapByteArray(void * bytes, bool readOnly, easyar_FunctorOfVoid deleter, easyar_Buffer * * Return)
C++17: static std::shared_ptr<Buffer> wrapByteArray(void * bytes, bool readOnly, std::function<void()> deleter)
Traditional C++: static void wrapByteArray(void * bytes, bool readOnly, FunctorOfVoid deleter, Buffer * * Return)
Java: public static @Nonnull Buffer wrapByteArray(long bytes, boolean readOnly, @Nonnull FunctorOfVoid deleter)
Kotlin: companion object fun wrapByteArray(bytes: Long, readOnly: Boolean, deleter: FunctorOfVoid): Buffer
Objective-C: + (easyar_Buffer *)wrapByteArray:(void *)bytes readOnly:(bool)readOnly deleter:(void (^)())deleter
Swift: public static func wrapByteArray(_ bytes: OpaquePointer?, _ readOnly: Bool, _ deleter: @escaping () -> Void) -> Buffer
C#: public static Buffer wrapByteArray(IntPtr bytes, bool readOnly, Action deleter)

wrapBuffer

包装Java的java.nio.ByteBuffer中的direct buffer。

C: void easyar_JniUtility_wrapBuffer(void * directBuffer, easyar_FunctorOfVoid deleter, easyar_Buffer * * Return)
C++17: static std::shared_ptr<Buffer> wrapBuffer(void * directBuffer, std::function<void()> deleter)
Traditional C++: static void wrapBuffer(void * directBuffer, FunctorOfVoid deleter, Buffer * * Return)
Java: public static @Nonnull Buffer wrapBuffer(long directBuffer, @Nonnull FunctorOfVoid deleter)
Kotlin: companion object fun wrapBuffer(directBuffer: Long, deleter: FunctorOfVoid): Buffer
Objective-C: + (easyar_Buffer *)wrapBuffer:(void *)directBuffer deleter:(void (^)())deleter
Swift: public static func wrapBuffer(_ directBuffer: OpaquePointer?, _ deleter: @escaping () -> Void) -> Buffer
C#: public static Buffer wrapBuffer(IntPtr directBuffer, Action deleter)