Package org.bytedeco.javacpp.indexer
Class ByteIndexer
java.lang.Object
org.bytedeco.javacpp.indexer.Indexer
org.bytedeco.javacpp.indexer.ByteIndexer
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
ByteArrayIndexer
,ByteBufferIndexer
,ByteRawIndexer
Abstract indexer for the
byte
primitive type.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The number of bytes used to represent a byte. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ByteIndexer
(long[] sizes, long[] strides) protected
ByteIndexer
(Index index) -
Method Summary
Modifier and TypeMethodDescriptionstatic ByteIndexer
create
(byte[] array) Returnsnew ByteArrayIndexer(array)
static ByteIndexer
create
(byte[] array, long... sizes) Returnsnew ByteArrayIndexer(array, sizes)
static ByteIndexer
create
(byte[] array, long[] sizes, long[] strides) Returnsnew ByteArrayIndexer(array, sizes, strides)
static ByteIndexer
Returnsnew ByteArrayIndexer(array, index)
static ByteIndexer
create
(ByteBuffer buffer) Returnsnew ByteBufferIndexer(buffer)
static ByteIndexer
create
(ByteBuffer buffer, long... sizes) Returnsnew ByteBufferIndexer(buffer, sizes)
static ByteIndexer
create
(ByteBuffer buffer, long[] sizes, long[] strides) Returnsnew ByteBufferIndexer(buffer, sizes, strides)
static ByteIndexer
create
(ByteBuffer buffer, Index index) Returnsnew ByteBufferIndexer(buffer, index)
static ByteIndexer
create
(BytePointer pointer) Returnsnew ByteRawIndexer(pointer)
static ByteIndexer
create
(BytePointer pointer, long... sizes) Returnsnew ByteRawIndexer(pointer, index)
static ByteIndexer
create
(BytePointer pointer, long[] sizes, long[] strides) Returnsnew ByteRawIndexer(pointer, sizes, strides)
static ByteIndexer
create
(BytePointer pointer, long[] sizes, long[] strides, boolean direct) Returnscreate(pointer, Index.create(sizes, strides), direct)
static ByteIndexer
create
(BytePointer pointer, Index index) Returnsnew ByteRawIndexer(pointer, index)
static ByteIndexer
create
(BytePointer pointer, Index index, boolean direct) Creates a byte indexer to access efficiently the data of a pointer.abstract byte
get
(long i) Returnsarray/buffer[index(i)]
abstract byte
get
(long... indices) Returnsarray/buffer[index(indices)]
get
(long[] indices, byte[] b) Returnsthis
whereb = array/buffer[index(indices)]
abstract ByteIndexer
get
(long[] indices, byte[] b, int offset, int length) Returnsthis
whereb[offset:offset + length] = array/buffer[index(indices)]
get
(long i, byte[] b) Returnsthis
whereb = array/buffer[index(i)]
abstract ByteIndexer
get
(long i, byte[] b, int offset, int length) Returnsthis
whereb[offset:offset + length] = array/buffer[index(i)]
abstract byte
get
(long i, long j) Returnsarray/buffer[index(i, j)]
get
(long i, long j, byte[] b) Returnsthis
whereb = array/buffer[index(i, j)]
abstract ByteIndexer
get
(long i, long j, byte[] b, int offset, int length) Returnsthis
whereb[offset:offset + length] = array/buffer[index(i, j)]
abstract byte
get
(long i, long j, long k) Returnsarray/buffer[index(i, j, k)]
float
getBfloat16
(long i) Returns theshort
value atarray/buffer[i]
, treated as bfloat16boolean
getBoolean
(long i) Returns theboolean
value atarray/buffer[i]
abstract byte
getByte
(long i) Returns thebyte
value atarray/buffer[i]
abstract char
getChar
(long i) Returns thechar
value atarray/buffer[i]
abstract double
getDouble
(long i) Returns thedouble
value atarray/buffer[i]
double
getDouble
(long... indices) Callsget(int...indices)
and returns the value as a double.abstract float
getFloat
(long i) Returns thefloat
value atarray/buffer[i]
float
getHalf
(long i) Returns theshort
value atarray/buffer[i]
, treated as half-precision floatabstract int
getInt
(long i) Returns theint
value atarray/buffer[i]
abstract long
getLong
(long i) Returns thelong
value atarray/buffer[i]
abstract short
getShort
(long i) Returns theshort
value atarray/buffer[i]
int
getUByte
(long i) Returns thebyte
value atarray/buffer[i]
, treated as unsignedlong
getUInt
(long i) Returns theint
value atarray/buffer[i]
, treated as unsignedgetULong
(long i) Returns thelong
value atarray/buffer[i]
, treated as unsignedint
getUShort
(long i) Returns theshort
value atarray/buffer[i]
, treated as unsignedabstract ByteIndexer
put
(long[] indices, byte b) Returnsthis
wherearray/buffer[index(indices)] = b
put
(long[] indices, byte... b) Returnsthis
wherearray/buffer[index(indices)] = b
abstract ByteIndexer
put
(long[] indices, byte[] b, int offset, int length) Returnsthis
wherearray/buffer[index(indices)] = b[offset:offset + length]
abstract ByteIndexer
put
(long i, byte b) Returnsthis
wherearray/buffer[index(i)] = b
put
(long i, byte... b) Returnsthis
wherearray/buffer[index(i)] = b
abstract ByteIndexer
put
(long i, byte[] b, int offset, int length) Returnsthis
wherearray/buffer[index(i)] = b[offset:offset + length]
abstract ByteIndexer
put
(long i, long j, byte b) Returnsthis
wherearray/buffer[index(i, j)] = b
put
(long i, long j, byte... b) Returnsthis
wherearray/buffer[index(i, j)] = b
abstract ByteIndexer
put
(long i, long j, byte[] b, int offset, int length) Returnsthis
wherearray/buffer[index(i, j)] = b[offset:offset + length]
abstract ByteIndexer
put
(long i, long j, long k, byte b) Returnsthis
wherearray/buffer[index(i, j, k)] = b
putBfloat16
(long i, float h) Sets theshort
value atarray/buffer[i]
, treated as bfloat16putBoolean
(long i, boolean b) Sets theboolean
value atarray/buffer[i]
abstract ByteIndexer
putByte
(long i, byte b) Sets thebyte
value atarray/buffer[i]
abstract ByteIndexer
putChar
(long i, char c) Sets thechar
value atarray/buffer[i]
putDouble
(long[] indices, double b) Casts value to primitive type and callsput(long[] indices, <type> value)
.abstract ByteIndexer
putDouble
(long i, double d) Sets thedouble
value atarray/buffer[i]
abstract ByteIndexer
putFloat
(long i, float f) Sets thefloat
value atarray/buffer[i]
putHalf
(long i, float h) Sets theshort
value atarray/buffer[i]
, treated as half-precision floatabstract ByteIndexer
putInt
(long i, int j) Sets theint
value atarray/buffer[i]
abstract ByteIndexer
putLong
(long i, long j) Sets thelong
value atarray/buffer[i]
abstract ByteIndexer
putShort
(long i, short s) Sets theshort
value atarray/buffer[i]
putUByte
(long i, int b) Sets thebyte
value atarray/buffer[i]
, treated as unsignedputUInt
(long i, long n) Sets theint
value atarray/buffer[i]
, treated as unsignedputULong
(long i, BigInteger l) Sets thelong
value atarray/buffer[i]
, treated as unsignedputUShort
(long i, int s) Sets theshort
value atarray/buffer[i]
, treated as unsigned
-
Field Details
-
VALUE_BYTES
public static final int VALUE_BYTESThe number of bytes used to represent a byte.- See Also:
-
-
Constructor Details
-
ByteIndexer
-
ByteIndexer
protected ByteIndexer(long[] sizes, long[] strides)
-
-
Method Details
-
create
Returnsnew ByteArrayIndexer(array)
-
create
Returnsnew ByteBufferIndexer(buffer)
-
create
Returnsnew ByteRawIndexer(pointer)
-
create
Returnsnew ByteArrayIndexer(array, index)
-
create
Returnsnew ByteBufferIndexer(buffer, index)
-
create
Returnsnew ByteRawIndexer(pointer, index)
-
create
Returnsnew ByteArrayIndexer(array, sizes)
-
create
Returnsnew ByteBufferIndexer(buffer, sizes)
-
create
Returnsnew ByteRawIndexer(pointer, index)
-
create
Returnsnew ByteArrayIndexer(array, sizes, strides)
-
create
Returnsnew ByteBufferIndexer(buffer, sizes, strides)
-
create
Returnsnew ByteRawIndexer(pointer, sizes, strides)
-
create
Returnscreate(pointer, Index.create(sizes, strides), direct)
-
create
Creates a byte indexer to access efficiently the data of a pointer.- Parameters:
pointer
- data to access via a buffer or to copy to an arrayindex
- to usedirect
-true
to use a direct buffer, seeIndexer
for details- Returns:
- the new byte indexer backed by the raw memory interface, a buffer, or an array
-
get
public abstract byte get(long i) Returnsarray/buffer[index(i)]
-
get
Returnsthis
whereb = array/buffer[index(i)]
-
get
Returnsthis
whereb[offset:offset + length] = array/buffer[index(i)]
-
get
public abstract byte get(long i, long j) Returnsarray/buffer[index(i, j)]
-
get
Returnsthis
whereb = array/buffer[index(i, j)]
-
get
Returnsthis
whereb[offset:offset + length] = array/buffer[index(i, j)]
-
get
public abstract byte get(long i, long j, long k) Returnsarray/buffer[index(i, j, k)]
-
get
public abstract byte get(long... indices) Returnsarray/buffer[index(indices)]
-
get
Returnsthis
whereb = array/buffer[index(indices)]
-
get
Returnsthis
whereb[offset:offset + length] = array/buffer[index(indices)]
-
put
Returnsthis
wherearray/buffer[index(i)] = b
-
put
Returnsthis
wherearray/buffer[index(i)] = b
-
put
Returnsthis
wherearray/buffer[index(i)] = b[offset:offset + length]
-
put
Returnsthis
wherearray/buffer[index(i, j)] = b
-
put
Returnsthis
wherearray/buffer[index(i, j)] = b
-
put
Returnsthis
wherearray/buffer[index(i, j)] = b[offset:offset + length]
-
put
Returnsthis
wherearray/buffer[index(i, j, k)] = b
-
put
Returnsthis
wherearray/buffer[index(indices)] = b
-
put
Returnsthis
wherearray/buffer[index(indices)] = b
-
put
Returnsthis
wherearray/buffer[index(indices)] = b[offset:offset + length]
-
getByte
public abstract byte getByte(long i) Returns thebyte
value atarray/buffer[i]
-
putByte
Sets thebyte
value atarray/buffer[i]
-
getShort
public abstract short getShort(long i) Returns theshort
value atarray/buffer[i]
-
putShort
Sets theshort
value atarray/buffer[i]
-
getInt
public abstract int getInt(long i) Returns theint
value atarray/buffer[i]
-
putInt
Sets theint
value atarray/buffer[i]
-
getLong
public abstract long getLong(long i) Returns thelong
value atarray/buffer[i]
-
putLong
Sets thelong
value atarray/buffer[i]
-
getFloat
public abstract float getFloat(long i) Returns thefloat
value atarray/buffer[i]
-
putFloat
Sets thefloat
value atarray/buffer[i]
-
getDouble
public abstract double getDouble(long i) Returns thedouble
value atarray/buffer[i]
-
putDouble
Sets thedouble
value atarray/buffer[i]
-
getChar
public abstract char getChar(long i) Returns thechar
value atarray/buffer[i]
-
putChar
Sets thechar
value atarray/buffer[i]
-
getUByte
public int getUByte(long i) Returns thebyte
value atarray/buffer[i]
, treated as unsigned -
putUByte
Sets thebyte
value atarray/buffer[i]
, treated as unsigned -
getUShort
public int getUShort(long i) Returns theshort
value atarray/buffer[i]
, treated as unsigned -
putUShort
Sets theshort
value atarray/buffer[i]
, treated as unsigned -
getUInt
public long getUInt(long i) Returns theint
value atarray/buffer[i]
, treated as unsigned -
putUInt
Sets theint
value atarray/buffer[i]
, treated as unsigned -
getULong
Returns thelong
value atarray/buffer[i]
, treated as unsigned -
putULong
Sets thelong
value atarray/buffer[i]
, treated as unsigned -
getHalf
public float getHalf(long i) Returns theshort
value atarray/buffer[i]
, treated as half-precision float -
putHalf
Sets theshort
value atarray/buffer[i]
, treated as half-precision float -
getBfloat16
public float getBfloat16(long i) Returns theshort
value atarray/buffer[i]
, treated as bfloat16 -
putBfloat16
Sets theshort
value atarray/buffer[i]
, treated as bfloat16 -
getBoolean
public boolean getBoolean(long i) Returns theboolean
value atarray/buffer[i]
-
putBoolean
Sets theboolean
value atarray/buffer[i]
-
getDouble
public double getDouble(long... indices) Description copied from class:Indexer
Callsget(int...indices)
and returns the value as a double. -
putDouble
Description copied from class:Indexer
Casts value to primitive type and callsput(long[] indices, <type> value)
.
-