Table of Contents

Class Buffer

Namespace
easyar
Assembly
EasyAR.Sense.dll

Buffer stores a raw byte array, which can be used to access image data. In the Java API, you can obtain 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`_.

public class Buffer : RefBase, IDisposable
Inheritance
Buffer
Implements
Inherited Members

Methods

Clone()

public Buffer Clone()

Returns

CloneObject()

protected override object CloneObject()

Returns

copyFromByteArray(byte[])

public void copyFromByteArray(byte[] src)

Parameters

src

copyFromByteArray(byte[], int, int, int)

public void copyFromByteArray(byte[] src, int srcIndex, int index, int length)

Parameters

src
srcIndex
index
length

copyToByteArray(byte[])

public void copyToByteArray(byte[] dest)

Parameters

dest

copyToByteArray(int, byte[], int, int)

public void copyToByteArray(int index, byte[] dest, int destIndex, int length)

Parameters

index
dest
destIndex
length

create(int)

Creates a Buffer of a specified byte length.

public static Buffer create(int size)

Parameters

size

Returns

data()

Returns the raw memory address.

public virtual IntPtr data()

Returns

memoryCopy(IntPtr, IntPtr, int)

Copies raw memory. Mainly used for languages or environments with imperfect memory operations.

public static void memoryCopy(IntPtr src, IntPtr dest, int length)

Parameters

src
dest
length

partition(int, int)

Creates a child Buffer that references the original Buffer. A Buffer is only released after all its child Buffers are released.

public virtual Buffer partition(int index, int length)

Parameters

index
length

Returns

size()

The byte length of the Buffer.

public virtual int size()

Returns

tryCopyFrom(IntPtr, int, int, int)

Attempts to copy data from a raw memory address to the Buffer. Returns true if the copy is successful, otherwise false. Reasons for failure include: source data range or target data range exceeding available range.

public virtual bool tryCopyFrom(IntPtr src, int srcIndex, int index, int length)

Parameters

src
srcIndex
index
length

Returns

tryCopyTo(int, IntPtr, int, int)

Attempts to copy data from the Buffer to a raw memory address. Returns true if the copy is successful, otherwise false. Reasons for failure include: source data range or target data range exceeding available range.

public virtual bool tryCopyTo(int index, IntPtr dest, int destIndex, int length)

Parameters

index
dest
destIndex
length

Returns

wrap(IntPtr, int, Action)

Wraps a raw memory block of a specified length. When the Buffer is completely released, the deleter callback is called to execute user-defined memory destruction behavior. The deleter must be thread-safe.

public static Buffer wrap(IntPtr ptr, int size, Action deleter)

Parameters

ptr
size
deleter

Returns

wrapByteArray(byte[])

public static Buffer wrapByteArray(byte[] bytes)

Parameters

bytes

Returns

wrapByteArray(byte[], int, int)

public static Buffer wrapByteArray(byte[] bytes, int index, int length)

Parameters

bytes
index
length

Returns

wrapByteArray(byte[], int, int, Action)

public static Buffer wrapByteArray(byte[] bytes, int index, int length, Action deleter)

Parameters

bytes
index
length
deleter

Returns