Package org.bytedeco.javacpp.indexer
Class ByteIndexer
- java.lang.Object
-
- org.bytedeco.javacpp.indexer.Indexer
-
- org.bytedeco.javacpp.indexer.ByteIndexer
-
- All Implemented Interfaces:
java.lang.AutoCloseable
- Direct Known Subclasses:
ByteArrayIndexer
,ByteBufferIndexer
,ByteRawIndexer
public abstract class ByteIndexer extends Indexer
Abstract indexer for thebyte
primitive type.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ByteIndexer(long[] sizes, long[] strides)
protected
ByteIndexer(Index index)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static 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
create(byte[] array, Index index)
Returnsnew ByteArrayIndexer(array, index)
static ByteIndexer
create(java.nio.ByteBuffer buffer)
Returnsnew ByteBufferIndexer(buffer)
static ByteIndexer
create(java.nio.ByteBuffer buffer, long... sizes)
Returnsnew ByteBufferIndexer(buffer, sizes)
static ByteIndexer
create(java.nio.ByteBuffer buffer, long[] sizes, long[] strides)
Returnsnew ByteBufferIndexer(buffer, sizes, strides)
static ByteIndexer
create(java.nio.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)]
ByteIndexer
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)]
ByteIndexer
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)]
ByteIndexer
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 unsignedjava.math.BigInteger
getULong(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
ByteIndexer
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
ByteIndexer
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
ByteIndexer
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
ByteIndexer
putBfloat16(long i, float h)
Sets theshort
value atarray/buffer[i]
, treated as bfloat16ByteIndexer
putBoolean(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]
ByteIndexer
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]
ByteIndexer
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]
ByteIndexer
putUByte(long i, int b)
Sets thebyte
value atarray/buffer[i]
, treated as unsignedByteIndexer
putUInt(long i, long n)
Sets theint
value atarray/buffer[i]
, treated as unsignedByteIndexer
putULong(long i, java.math.BigInteger l)
Sets thelong
value atarray/buffer[i]
, treated as unsignedByteIndexer
putUShort(long i, int s)
Sets theshort
value atarray/buffer[i]
, treated as unsigned
-
-
-
Field Detail
-
VALUE_BYTES
public static final int VALUE_BYTES
The number of bytes used to represent a byte.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ByteIndexer
protected ByteIndexer(Index index)
-
ByteIndexer
protected ByteIndexer(long[] sizes, long[] strides)
-
-
Method Detail
-
create
public static ByteIndexer create(byte[] array)
Returnsnew ByteArrayIndexer(array)
-
create
public static ByteIndexer create(java.nio.ByteBuffer buffer)
Returnsnew ByteBufferIndexer(buffer)
-
create
public static ByteIndexer create(BytePointer pointer)
Returnsnew ByteRawIndexer(pointer)
-
create
public static ByteIndexer create(byte[] array, Index index)
Returnsnew ByteArrayIndexer(array, index)
-
create
public static ByteIndexer create(java.nio.ByteBuffer buffer, Index index)
Returnsnew ByteBufferIndexer(buffer, index)
-
create
public static ByteIndexer create(BytePointer pointer, Index index)
Returnsnew ByteRawIndexer(pointer, index)
-
create
public static ByteIndexer create(byte[] array, long... sizes)
Returnsnew ByteArrayIndexer(array, sizes)
-
create
public static ByteIndexer create(java.nio.ByteBuffer buffer, long... sizes)
Returnsnew ByteBufferIndexer(buffer, sizes)
-
create
public static ByteIndexer create(BytePointer pointer, long... sizes)
Returnsnew ByteRawIndexer(pointer, index)
-
create
public static ByteIndexer create(byte[] array, long[] sizes, long[] strides)
Returnsnew ByteArrayIndexer(array, sizes, strides)
-
create
public static ByteIndexer create(java.nio.ByteBuffer buffer, long[] sizes, long[] strides)
Returnsnew ByteBufferIndexer(buffer, sizes, strides)
-
create
public static ByteIndexer create(BytePointer pointer, long[] sizes, long[] strides)
Returnsnew ByteRawIndexer(pointer, sizes, strides)
-
create
public static ByteIndexer create(BytePointer pointer, long[] sizes, long[] strides, boolean direct)
Returnscreate(pointer, Index.create(sizes, strides), direct)
-
create
public static ByteIndexer create(BytePointer pointer, Index index, boolean direct)
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
public ByteIndexer get(long i, byte[] b)
Returnsthis
whereb = array/buffer[index(i)]
-
get
public abstract ByteIndexer get(long i, byte[] b, int offset, int length)
Returnsthis
whereb[offset:offset + length] = array/buffer[index(i)]
-
get
public abstract byte get(long i, long j)
Returnsarray/buffer[index(i, j)]
-
get
public ByteIndexer get(long i, long j, byte[] b)
Returnsthis
whereb = array/buffer[index(i, j)]
-
get
public abstract ByteIndexer get(long i, long j, byte[] b, int offset, int length)
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
public ByteIndexer get(long[] indices, byte[] b)
Returnsthis
whereb = array/buffer[index(indices)]
-
get
public abstract ByteIndexer get(long[] indices, byte[] b, int offset, int length)
Returnsthis
whereb[offset:offset + length] = array/buffer[index(indices)]
-
put
public abstract ByteIndexer put(long i, byte b)
Returnsthis
wherearray/buffer[index(i)] = b
-
put
public ByteIndexer put(long i, byte... b)
Returnsthis
wherearray/buffer[index(i)] = b
-
put
public abstract ByteIndexer put(long i, byte[] b, int offset, int length)
Returnsthis
wherearray/buffer[index(i)] = b[offset:offset + length]
-
put
public abstract ByteIndexer put(long i, long j, byte b)
Returnsthis
wherearray/buffer[index(i, j)] = b
-
put
public ByteIndexer put(long i, long j, byte... b)
Returnsthis
wherearray/buffer[index(i, j)] = b
-
put
public abstract ByteIndexer put(long i, long j, byte[] b, int offset, int length)
Returnsthis
wherearray/buffer[index(i, j)] = b[offset:offset + length]
-
put
public abstract ByteIndexer put(long i, long j, long k, byte b)
Returnsthis
wherearray/buffer[index(i, j, k)] = b
-
put
public abstract ByteIndexer put(long[] indices, byte b)
Returnsthis
wherearray/buffer[index(indices)] = b
-
put
public ByteIndexer put(long[] indices, byte... b)
Returnsthis
wherearray/buffer[index(indices)] = b
-
put
public abstract ByteIndexer put(long[] indices, byte[] b, int offset, int length)
Returnsthis
wherearray/buffer[index(indices)] = b[offset:offset + length]
-
getByte
public abstract byte getByte(long i)
Returns thebyte
value atarray/buffer[i]
-
putByte
public abstract ByteIndexer putByte(long i, byte b)
Sets thebyte
value atarray/buffer[i]
-
getShort
public abstract short getShort(long i)
Returns theshort
value atarray/buffer[i]
-
putShort
public abstract ByteIndexer putShort(long i, short s)
Sets theshort
value atarray/buffer[i]
-
getInt
public abstract int getInt(long i)
Returns theint
value atarray/buffer[i]
-
putInt
public abstract ByteIndexer putInt(long i, int j)
Sets theint
value atarray/buffer[i]
-
getLong
public abstract long getLong(long i)
Returns thelong
value atarray/buffer[i]
-
putLong
public abstract ByteIndexer putLong(long i, long j)
Sets thelong
value atarray/buffer[i]
-
getFloat
public abstract float getFloat(long i)
Returns thefloat
value atarray/buffer[i]
-
putFloat
public abstract ByteIndexer putFloat(long i, float f)
Sets thefloat
value atarray/buffer[i]
-
getDouble
public abstract double getDouble(long i)
Returns thedouble
value atarray/buffer[i]
-
putDouble
public abstract ByteIndexer putDouble(long i, double d)
Sets thedouble
value atarray/buffer[i]
-
getChar
public abstract char getChar(long i)
Returns thechar
value atarray/buffer[i]
-
putChar
public abstract ByteIndexer putChar(long i, char c)
Sets thechar
value atarray/buffer[i]
-
getUByte
public int getUByte(long i)
Returns thebyte
value atarray/buffer[i]
, treated as unsigned
-
putUByte
public ByteIndexer putUByte(long i, int b)
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
public ByteIndexer putUShort(long i, int s)
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
public ByteIndexer putUInt(long i, long n)
Sets theint
value atarray/buffer[i]
, treated as unsigned
-
getULong
public java.math.BigInteger getULong(long i)
Returns thelong
value atarray/buffer[i]
, treated as unsigned
-
putULong
public ByteIndexer putULong(long i, java.math.BigInteger l)
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
public ByteIndexer putHalf(long i, float h)
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
public ByteIndexer putBfloat16(long i, float h)
Sets theshort
value atarray/buffer[i]
, treated as bfloat16
-
getBoolean
public boolean getBoolean(long i)
Returns theboolean
value atarray/buffer[i]
-
putBoolean
public ByteIndexer putBoolean(long i, boolean b)
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
public ByteIndexer putDouble(long[] indices, double b)
Description copied from class:Indexer
Casts value to primitive type and callsput(long[] indices, <type> value)
.
-
-