Class Buffer
Buffer almacena una matriz de bytes sin procesar, que se puede utilizar para acceder a datos de imagen.
En la API de Java, se puede obtener el buffer de Image y copiar los datos a una matriz de bytes de Java.
En todas las versiones de EasyAR Sense, se puede acceder a los datos de imagen. Consulte Image.
Buffer
Métodos
wrap
Envuelve un bloque de memoria sin procesar de longitud especificada. Cuando el Buffer se libera completamente, se llamará al callback deleter para ejecutar el comportamiento personalizado de eliminación de memoria. El deleter debe ser 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)
Parámetros
| Nombre |
Tipo |
Descripción |
| ptr |
IntPtr |
|
| size |
Int32 |
|
| deleter |
Action |
|
Devuelve
create
Crea un Buffer con una longitud de bytes especificada.
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)
Parámetros
| Nombre |
Tipo |
Descripción |
| size |
Int32 |
|
Devuelve
data
Devuelve la dirección de memoria sin procesar.
void * easyar_Buffer_data(const easyar_Buffer * This)
public func data() -> OpaquePointer?
public virtual IntPtr data()
Devuelve
size
Longitud en bytes del Buffer.
int easyar_Buffer_size(const easyar_Buffer * This)
public func size() -> Int32
public virtual int size()
Devuelve
memoryCopy
Copia la memoria sin procesar. Principalmente utilizado en lenguajes o entornos con operaciones de memoria imperfectas.
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)
Parámetros
| Nombre |
Tipo |
Descripción |
| src |
IntPtr |
|
| dest |
IntPtr |
|
| length |
Int32 |
|
Devuelve
tryCopyFrom
Intenta copiar datos desde una dirección de memoria sin procesar al Buffer. Devuelve true si tiene éxito, false en caso contrario. Las razones de fallo incluyen: el rango de datos de origen o destino está fuera del rango disponible.
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)
Parámetros
| Nombre |
Tipo |
Descripción |
| src |
IntPtr |
|
| srcIndex |
Int32 |
|
| index |
Int32 |
|
| length |
Int32 |
|
Devuelve
tryCopyTo
Intenta copiar datos desde el Buffer a una dirección de memoria sin procesar. Devuelve true si tiene éxito, false en caso contrario. Las razones de fallo incluyen: el rango de datos de origen o destino está fuera del rango disponible.
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)
Parámetros
| Nombre |
Tipo |
Descripción |
| index |
Int32 |
|
| dest |
IntPtr |
|
| destIndex |
Int32 |
|
| length |
Int32 |
|
Devuelve
partition
Crea un sub-Buffer que referencia al Buffer original. Un Buffer se libera solo después de que todos sus sub-Buffers se hayan liberado.
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)
Parámetros
| Nombre |
Tipo |
Descripción |
| index |
Int32 |
|
| length |
Int32 |
|
Devuelve
wrapByteArray
Envuelve una matriz de bytes.
public static @Nonnull Buffer wrapByteArray(byte @Nonnull[] bytes)
companion object fun wrapByteArray(bytes: Array<Byte>): Buffer
public static Buffer wrapByteArray(byte[] bytes)
Parámetros
| Nombre |
Tipo |
Descripción |
| bytes |
|
|
Devuelve
wrapByteArray
Envuelve una matriz de bytes. Se puede especificar la posición inicial y la longitud, y si el Buffer es de solo lectura o lectura/escritura (los Buffers de solo lectura pueden liberarse más rápido). Se puede especificar un callback deleter que se llamará cuando el Buffer se libere completamente, ejecutando el comportamiento personalizado de eliminación de memoria. El deleter debe ser 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
Parámetros
| Nombre |
Tipo |
Descripción |
| bytes |
|
|
| index |
Int32 |
|
| length |
Int32 |
|
| readOnly |
Boolean |
|
| deleter |
Action |
|
Devuelve
wrapByteArray
Envuelve una matriz de bytes. Se puede especificar la posición inicial y la longitud.
public static Buffer wrapByteArray(byte[] bytes, int index, int length)
Parámetros
| Nombre |
Tipo |
Descripción |
| bytes |
|
|
| index |
Int32 |
|
| length |
Int32 |
|
Devuelve
wrapByteArray
Envuelve una matriz de bytes. Se puede especificar la posición inicial y la longitud. Se puede especificar un callback deleter que se llamará cuando el Buffer se libere completamente, ejecutando el comportamiento personalizado de eliminación de memoria. El deleter debe ser thread-safe.
public static Buffer wrapByteArray(byte[] bytes, int index, int length, Action deleter)
Parámetros
| Nombre |
Tipo |
Descripción |
| bytes |
|
|
| index |
Int32 |
|
| length |
Int32 |
|
| deleter |
Action |
|
Devuelve
wrapBuffer
Envuelve un java.nio.Buffer.
public static @Nonnull Buffer wrapBuffer(java.nio.@Nonnull Buffer directBuffer)
companion object fun wrapBuffer(directBuffer: java.nio.Buffer): Buffer
Parámetros
| Nombre |
Tipo |
Descripción |
| directBuffer |
|
|
Devuelve
wrapBuffer
Envuelve un java.nio.Buffer. Se puede especificar un callback deleter que se llamará cuando el Buffer se libere completamente, ejecutando el comportamiento personalizado de eliminación de memoria. El deleter debe ser 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
Parámetros
| Nombre |
Tipo |
Descripción |
| directBuffer |
|
|
| deleter |
Action |
|
Devuelve
copyFromByteArray
Copia datos desde una matriz de bytes al Buffer. Lanza una excepción si falla. Las razones de fallo incluyen: el rango de datos de origen o destino está fuera del rango disponible.
public void copyFromByteArray(byte @Nonnull[] src)
fun copyFromByteArray(src: Array<Byte>): Unit
public void copyFromByteArray(byte[] src)
Parámetros
| Nombre |
Tipo |
Descripción |
| src |
|
|
copyFromByteArray
Copia datos desde una matriz de bytes al Buffer. Lanza una excepción si falla. Las razones de fallo incluyen: el rango de datos de origen o destino está fuera del rango disponible.
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)
Parámetros
| Nombre |
Tipo |
Descripción |
| src |
|
|
| srcIndex |
Int32 |
|
| index |
Int32 |
|
| length |
Int32 |
|
copyToByteArray
Copia datos desde el Buffer a una matriz de bytes. Lanza una excepción si falla. Las razones de fallo incluyen: el rango de datos de origen o destino está fuera del rango disponible.
public void copyToByteArray(byte @Nonnull[] dest)
fun copyToByteArray(dest: Array<Byte>): Unit
public void copyToByteArray(byte[] dest)
Parámetros
| Nombre |
Tipo |
Descripción |
| dest |
|
|
copyToByteArray
Copia datos desde el Buffer a una matriz de bytes. Lanza una excepción si falla. Las razones de fallo incluyen: el rango de datos de origen o destino está fuera del rango disponible.
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)
Parámetros
| Nombre |
Tipo |
Descripción |
| index |
Int32 |
|
| dest |
|
|
| destIndex |
Int32 |
|
| length |
Int32 |
|
tryCopyFromByteArray
Copia datos desde una matriz de bytes al Buffer. Devuelve true si tiene éxito, false en caso contrario. Las razones de fallo incluyen: el rango de datos de origen o destino está fuera del rango disponible.
public func tryCopyFromByteArray(_ src: [UInt8]) -> Bool
Parámetros
| Nombre |
Tipo |
Descripción |
| src |
|
|
Devuelve
tryCopyFromByteArray
Copia datos desde una matriz de bytes al Buffer. Devuelve true si tiene éxito, false en caso contrario. Las razones de fallo incluyen: el rango de datos de origen o destino está fuera del rango disponible.
public func tryCopyFromByteArray(_ src: [UInt8], _ srcIndex: Int32, _ index: Int32, _ length: Int32) -> Bool
Parámetros
| Nombre |
Tipo |
Descripción |
| src |
|
|
| srcIndex |
Int32 |
|
| index |
Int32 |
|
| length |
Int32 |
|
Devuelve
tryCopyToByteArray
Copia datos desde el Buffer a una matriz de bytes. Devuelve true si tiene éxito, false en caso contrario. Las razones de fallo incluyen: el rango de datos de origen o destino está fuera del rango disponible.
public func tryCopyToByteArray(_ dest: [UInt8]) -> Bool
Parámetros
| Nombre |
Tipo |
Descripción |
| dest |
|
|
Devuelve
tryCopyToByteArray
Copia datos desde el Buffer a una matriz de bytes. Devuelve true si tiene éxito, false en caso contrario. Las razones de fallo incluyen: el rango de datos de origen o destino está fuera del rango disponible.
public func tryCopyToByteArray(_ index: Int32, _ dest: [UInt8], _ destIndex: Int32, _ length: Int32) -> Bool
Parámetros
| Nombre |
Tipo |
Descripción |
| index |
Int32 |
|
| dest |
|
|
| destIndex |
Int32 |
|
| length |
Int32 |
|
Devuelve