Class Buffer
Buffer speichert ein raw byte array und kann zum Zugriff auf image data verwendet werden. In the Java API, you can get the buffer from Image and then copy data to a Java byte array. In all versions of EasyAR Sense, you can access image data. Refer to Image.
Buffer
Methoden
wrap
Wrappt a raw memory block of a specified length. When Buffer is fully released, the deleter callback is called to execute user-defined memory destruction behavior. deleter must be thread-safe.
void easyar_Buffer_wrap(void * ptr, int size, easyar_FunctorOfVoid deleter, easyar_Buffer * * Return)
static std::shared_ptr<Buffer> wrap(void * ptr, int size, std::function<void()> deleter)
public static @Nonnull Buffer wrap(long ptr, int size, @Nonnull FunctorOfVoid deleter)
companion object fun wrap(ptr: Long, size: Int, deleter: FunctorOfVoid): Buffer
+ (easyar_Buffer *)wrap:(void *)ptr size:(int)size deleter:(void (^)())deleter
public static func wrap(_ ptr: OpaquePointer?, _ size: Int32, _ deleter: @escaping () -> Void) -> Buffer
public static Buffer wrap(IntPtr ptr, int size, Action deleter)
Parameter
| Name |
Typ |
Beschreibung |
| ptr |
IntPtr |
|
| size |
Int32 |
|
| deleter |
Action |
|
Rückgabewert
create
Erstellt a Buffer with the specified byte length.
void easyar_Buffer_create(int size, easyar_Buffer * * Return)
static std::shared_ptr<Buffer> create(int size)
public static @Nonnull Buffer create(int size)
companion object fun create(size: Int): Buffer
+ (easyar_Buffer *)create:(int)size
public static func create(_ size: Int32) -> Buffer
public static Buffer create(int size)
Parameter
| Name |
Typ |
Beschreibung |
| size |
Int32 |
|
Rückgabewert
data
Gibt zurück the raw memory address.
void * easyar_Buffer_data(const easyar_Buffer * This)
public func data() -> OpaquePointer?
public virtual IntPtr data()
Rückgabewert
size
int easyar_Buffer_size(const easyar_Buffer * This)
public func size() -> Int32
public virtual int size()
Rückgabewert
memoryCopy
Kopiert raw memory. Mainly used for languages or environments with incomplete memory operations.
void easyar_Buffer_memoryCopy(void * src, void * dest, int length)
static void memoryCopy(void * src, void * dest, int length)
public static void memoryCopy(long src, long dest, int length)
companion object fun memoryCopy(src: Long, dest: Long, length: Int): Unit
+ (void)memoryCopy:(void *)src dest:(void *)dest length:(int)length
public static func memoryCopy(_ src: OpaquePointer?, _ dest: OpaquePointer?, _ length: Int32) -> Void
public static void memoryCopy(IntPtr src, IntPtr dest, int length)
Parameter
| Name |
Typ |
Beschreibung |
| src |
IntPtr |
|
| dest |
IntPtr |
|
| length |
Int32 |
|
Rückgabewert
tryCopyFrom
Versucht zu kopieren data from a raw memory address to Buffer. Wenn die copy erfolgreich ist, wird true zurückgegeben; andernfalls false. Failure reasons include: the source data range or target data range exceeds the available range.
bool easyar_Buffer_tryCopyFrom(easyar_Buffer * This, void * src, int srcIndex, int index, int length)
bool tryCopyFrom(void * src, int srcIndex, int index, int length)
public boolean tryCopyFrom(long src, int srcIndex, int index, int length)
fun tryCopyFrom(src: Long, srcIndex: Int, index: Int, length: Int): Boolean
- (bool)tryCopyFrom:(void *)src srcIndex:(int)srcIndex index:(int)index length:(int)length
public func tryCopyFrom(_ src: OpaquePointer?, _ srcIndex: Int32, _ index: Int32, _ length: Int32) -> Bool
public virtual bool tryCopyFrom(IntPtr src, int srcIndex, int index, int length)
Parameter
| Name |
Typ |
Beschreibung |
| src |
IntPtr |
|
| srcIndex |
Int32 |
|
| index |
Int32 |
|
| length |
Int32 |
|
Rückgabewert
tryCopyTo
Versucht zu kopieren data from Buffer to a raw memory address. Wenn die copy erfolgreich ist, wird true zurückgegeben; andernfalls false. Failure reasons include: the source data range or target data range exceeds the available range.
bool easyar_Buffer_tryCopyTo(easyar_Buffer * This, int index, void * dest, int destIndex, int length)
bool tryCopyTo(int index, void * dest, int destIndex, int length)
public boolean tryCopyTo(int index, long dest, int destIndex, int length)
fun tryCopyTo(index: Int, dest: Long, destIndex: Int, length: Int): Boolean
- (bool)tryCopyTo:(int)index dest:(void *)dest destIndex:(int)destIndex length:(int)length
public func tryCopyTo(_ index: Int32, _ dest: OpaquePointer?, _ destIndex: Int32, _ length: Int32) -> Bool
public virtual bool tryCopyTo(int index, IntPtr dest, int destIndex, int length)
Parameter
| Name |
Typ |
Beschreibung |
| index |
Int32 |
|
| dest |
IntPtr |
|
| destIndex |
Int32 |
|
| length |
Int32 |
|
Rückgabewert
partition
Erstellt a sub-Buffer and references the original Buffer. A Buffer is released only after all sub-Buffers are released.
void easyar_Buffer_partition(easyar_Buffer * This, int index, int length, easyar_Buffer * * Return)
std::shared_ptr<Buffer> partition(int index, int length)
public @Nonnull Buffer partition(int index, int length)
fun partition(index: Int, length: Int): Buffer
- (easyar_Buffer *)partition:(int)index length:(int)length
public func partition(_ index: Int32, _ length: Int32) -> Buffer
public virtual Buffer partition(int index, int length)
Parameter
| Name |
Typ |
Beschreibung |
| index |
Int32 |
|
| length |
Int32 |
|
Rückgabewert
wrapByteArray
public static @Nonnull Buffer wrapByteArray(byte @Nonnull[] bytes)
companion object fun wrapByteArray(bytes: Array<Byte>): Buffer
public static Buffer wrapByteArray(byte[] bytes)
Parameter
| Name |
Typ |
Beschreibung |
| bytes |
|
|
Rückgabewert
wrapByteArray
Wrappt a byte array. You can specify the start position and length, specify whether the Buffer is read-only or read-write (a read-only Buffer may release faster), and specify a deleter callback. When Buffer is fully released, the deleter callback is called to execute user-defined memory destruction behavior. deleter must be thread-safe.
public static @Nonnull Buffer wrapByteArray(byte @Nonnull[] bytes, int index, int length, boolean readOnly, @Nonnull FunctorOfVoid deleter)
companion object fun wrapByteArray(bytes: Array<Byte>, index: Int, length: Int, readOnly: Boolean, deleter: FunctorOfVoid): Buffer
Parameter
| Name |
Typ |
Beschreibung |
| bytes |
|
|
| index |
Int32 |
|
| length |
Int32 |
|
| readOnly |
Boolean |
|
| deleter |
Action |
|
Rückgabewert
wrapByteArray
Wrappt a byte array. You can specify the start position and length.
public static Buffer wrapByteArray(byte[] bytes, int index, int length)
Parameter
| Name |
Typ |
Beschreibung |
| bytes |
|
|
| index |
Int32 |
|
| length |
Int32 |
|
Rückgabewert
wrapByteArray
Wrappt a byte array. You can specify the start position and length, and specify a deleter callback. When Buffer is fully released, the deleter callback is called to execute user-defined memory destruction behavior. deleter must be thread-safe.
public static Buffer wrapByteArray(byte[] bytes, int index, int length, Action deleter)
Parameter
| Name |
Typ |
Beschreibung |
| bytes |
|
|
| index |
Int32 |
|
| length |
Int32 |
|
| deleter |
Action |
|
Rückgabewert
wrapBuffer
Wrappt a java.nio.Buffer.
public static @Nonnull Buffer wrapBuffer(java.nio.@Nonnull Buffer directBuffer)
companion object fun wrapBuffer(directBuffer: java.nio.Buffer): Buffer
Parameter
| Name |
Typ |
Beschreibung |
| directBuffer |
|
|
Rückgabewert
wrapBuffer
Wrappt a java.nio.Buffer. You can specify a deleter callback. When Buffer is fully released, the deleter callback is called to execute user-defined memory destruction behavior. deleter must be thread-safe.
public static @Nonnull Buffer wrapBuffer(java.nio.@Nonnull Buffer directBuffer, @Nonnull FunctorOfVoid deleter)
companion object fun wrapBuffer(directBuffer: java.nio.Buffer, deleter: Action): Buffer
Parameter
| Name |
Typ |
Beschreibung |
| directBuffer |
|
|
| deleter |
Action |
|
Rückgabewert
copyFromByteArray
Kopiert data from a byte array to Buffer. Wenn die copy fehlschlägt, wird eine exception ausgelöst. Failure reasons include: the source data range or target data range exceeds the available range.
public void copyFromByteArray(byte @Nonnull[] src)
fun copyFromByteArray(src: Array<Byte>): Unit
public void copyFromByteArray(byte[] src)
Parameter
| Name |
Typ |
Beschreibung |
| src |
|
|
copyFromByteArray
Kopiert data from a byte array to Buffer. Wenn die copy fehlschlägt, wird eine exception ausgelöst. Failure reasons include: the source data range or target data range exceeds the available range.
public void copyFromByteArray(byte @Nonnull[] src, int srcIndex, int index, int length)
fun copyFromByteArray(src: Array<Byte>, srcIndex: Int, index: Int, length: Int): Unit
public void copyFromByteArray(byte[] src, int srcIndex, int index, int length)
Parameter
| Name |
Typ |
Beschreibung |
| src |
|
|
| srcIndex |
Int32 |
|
| index |
Int32 |
|
| length |
Int32 |
|
copyToByteArray
Kopiert data from Buffer to a byte array. Wenn die copy fehlschlägt, wird eine exception ausgelöst. Failure reasons include: the source data range or target data range exceeds the available range.
public void copyToByteArray(byte @Nonnull[] dest)
fun copyToByteArray(dest: Array<Byte>): Unit
public void copyToByteArray(byte[] dest)
Parameter
| Name |
Typ |
Beschreibung |
| dest |
|
|
copyToByteArray
Kopiert data from Buffer to a byte array. Wenn die copy fehlschlägt, wird eine exception ausgelöst. Failure reasons include: the source data range or target data range exceeds the available range.
public void copyToByteArray(int index, byte @Nonnull[] dest, int destIndex, int length)
fun copyToByteArray(index: Int, dest: Array<Byte>, destIndex: Int, length: Int): Unit
public void copyToByteArray(int index, byte[] dest, int destIndex, int length)
Parameter
| Name |
Typ |
Beschreibung |
| index |
Int32 |
|
| dest |
|
|
| destIndex |
Int32 |
|
| length |
Int32 |
|
tryCopyFromByteArray
Kopiert data from a byte array to Buffer. Wenn die copy erfolgreich ist, wird true zurückgegeben; andernfalls false. Failure reasons include: the source data range or target data range exceeds the available range.
public func tryCopyFromByteArray(_ src: [UInt8]) -> Bool
Parameter
| Name |
Typ |
Beschreibung |
| src |
|
|
Rückgabewert
tryCopyFromByteArray
Kopiert data from a byte array to Buffer. Wenn die copy erfolgreich ist, wird true zurückgegeben; andernfalls false. Failure reasons include: the source data range or target data range exceeds the available range.
public func tryCopyFromByteArray(_ src: [UInt8], _ srcIndex: Int32, _ index: Int32, _ length: Int32) -> Bool
Parameter
| Name |
Typ |
Beschreibung |
| src |
|
|
| srcIndex |
Int32 |
|
| index |
Int32 |
|
| length |
Int32 |
|
Rückgabewert
tryCopyToByteArray
Kopiert data from Buffer to a byte array. Wenn die copy erfolgreich ist, wird true zurückgegeben; andernfalls false. Failure reasons include: the source data range or target data range exceeds the available range.
public func tryCopyToByteArray(_ dest: [UInt8]) -> Bool
Parameter
| Name |
Typ |
Beschreibung |
| dest |
|
|
Rückgabewert
tryCopyToByteArray
Kopiert data from Buffer to a byte array. Wenn die copy erfolgreich ist, wird true zurückgegeben; andernfalls false. Failure reasons include: the source data range or target data range exceeds the available range.
public func tryCopyToByteArray(_ index: Int32, _ dest: [UInt8], _ destIndex: Int32, _ length: Int32) -> Bool
Parameter
| Name |
Typ |
Beschreibung |
| index |
Int32 |
|
| dest |
|
|
| destIndex |
Int32 |
|
| length |
Int32 |
|
Rückgabewert