Package org.bytedeco.javacpp.indexer
Class ByteArrayIndexer
- java.lang.Object
-
- org.bytedeco.javacpp.indexer.Indexer
-
- org.bytedeco.javacpp.indexer.ByteIndexer
-
- org.bytedeco.javacpp.indexer.ByteArrayIndexer
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class ByteArrayIndexer extends ByteIndexer
An indexer for abyte[]
array.
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]
array
The backing array.protected java.nio.ByteBuffer
buffer
The wrapping buffer.protected static Raw
RAW
The instance for the raw memory interface.-
Fields inherited from class org.bytedeco.javacpp.indexer.ByteIndexer
VALUE_BYTES
-
-
Constructor Summary
Constructors Constructor Description ByteArrayIndexer(byte[] array)
CallsByteArrayIndexer(array, Index.create(array.length))
.ByteArrayIndexer(byte[] array, long... sizes)
CallsByteArrayIndexer(array, Index.create(sizes))
.ByteArrayIndexer(byte[] array, long[] sizes, long[] strides)
CallsByteArrayIndexer(array, Index.create(sizes, strides))
.ByteArrayIndexer(byte[] array, Index index)
Constructor to set thearray
andIndexer.index
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
array()
Returns the backing array, ornull
if nonebyte
get(long i)
Returnsarray/buffer[index(i)]
byte
get(long... indices)
Returnsarray/buffer[index(indices)]
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, int offset, int length)
Returnsthis
whereb[offset:offset + length] = array/buffer[index(i)]
byte
get(long i, long j)
Returnsarray/buffer[index(i, j)]
ByteIndexer
get(long i, long j, byte[] b, int offset, int length)
Returnsthis
whereb[offset:offset + length] = array/buffer[index(i, j)]
byte
get(long i, long j, long k)
Returnsarray/buffer[index(i, j, k)]
(package private) java.nio.ByteBuffer
getBuffer()
byte
getByte(long i)
Returns thebyte
value atarray/buffer[i]
char
getChar(long i)
Returns thechar
value atarray/buffer[i]
double
getDouble(long i)
Returns thedouble
value atarray/buffer[i]
float
getFloat(long i)
Returns thefloat
value atarray/buffer[i]
int
getInt(long i)
Returns theint
value atarray/buffer[i]
long
getLong(long i)
Returns thelong
value atarray/buffer[i]
short
getShort(long i)
Returns theshort
value atarray/buffer[i]
ByteIndexer
put(long[] indices, byte b)
Returnsthis
wherearray/buffer[index(indices)] = b
ByteIndexer
put(long[] indices, byte[] b, int offset, int length)
Returnsthis
wherearray/buffer[index(indices)] = b[offset:offset + length]
ByteIndexer
put(long i, byte b)
Returnsthis
wherearray/buffer[index(i)] = b
ByteIndexer
put(long i, byte[] b, int offset, int length)
Returnsthis
wherearray/buffer[index(i)] = b[offset:offset + length]
ByteIndexer
put(long i, long j, byte b)
Returnsthis
wherearray/buffer[index(i, j)] = b
ByteIndexer
put(long i, long j, byte[] b, int offset, int length)
Returnsthis
wherearray/buffer[index(i, j)] = b[offset:offset + length]
ByteIndexer
put(long i, long j, long k, byte b)
Returnsthis
wherearray/buffer[index(i, j, k)] = b
ByteIndexer
putByte(long i, byte b)
Sets thebyte
value atarray/buffer[i]
ByteIndexer
putChar(long i, char c)
Sets thechar
value atarray/buffer[i]
ByteIndexer
putDouble(long i, double d)
Sets thedouble
value atarray/buffer[i]
ByteIndexer
putFloat(long i, float f)
Sets thefloat
value atarray/buffer[i]
ByteIndexer
putInt(long i, int j)
Sets theint
value atarray/buffer[i]
ByteIndexer
putLong(long i, long j)
Sets thelong
value atarray/buffer[i]
ByteIndexer
putShort(long i, short s)
Sets theshort
value atarray/buffer[i]
ByteIndexer
reindex(Index index)
Returns a new Indexer using the same data, but with a different Index.void
release()
Makes sure changes are reflected onto the backing memory and clears any references.-
Methods inherited from class org.bytedeco.javacpp.indexer.ByteIndexer
create, create, create, create, create, create, create, create, create, create, create, create, create, create, get, get, get, getBfloat16, getBoolean, getDouble, getHalf, getUByte, getUInt, getULong, getUShort, put, put, put, putBfloat16, putBoolean, putDouble, putHalf, putUByte, putUInt, putULong, putUShort
-
-
-
-
Field Detail
-
RAW
protected static final Raw RAW
The instance for the raw memory interface.
-
buffer
protected java.nio.ByteBuffer buffer
The wrapping buffer.
-
array
protected byte[] array
The backing array.
-
-
Constructor Detail
-
ByteArrayIndexer
public ByteArrayIndexer(byte[] array)
CallsByteArrayIndexer(array, Index.create(array.length))
.
-
ByteArrayIndexer
public ByteArrayIndexer(byte[] array, long... sizes)
CallsByteArrayIndexer(array, Index.create(sizes))
.
-
ByteArrayIndexer
public ByteArrayIndexer(byte[] array, long[] sizes, long[] strides)
CallsByteArrayIndexer(array, Index.create(sizes, strides))
.
-
ByteArrayIndexer
public ByteArrayIndexer(byte[] array, Index index)
Constructor to set thearray
andIndexer.index
.
-
-
Method Detail
-
array
public byte[] array()
Description copied from class:Indexer
Returns the backing array, ornull
if none
-
reindex
public ByteIndexer reindex(Index index)
Description copied from class:Indexer
Returns a new Indexer using the same data, but with a different Index.
-
get
public byte get(long i)
Description copied from class:ByteIndexer
Returnsarray/buffer[index(i)]
- Specified by:
get
in classByteIndexer
-
get
public ByteIndexer get(long i, byte[] b, int offset, int length)
Description copied from class:ByteIndexer
Returnsthis
whereb[offset:offset + length] = array/buffer[index(i)]
- Specified by:
get
in classByteIndexer
-
get
public byte get(long i, long j)
Description copied from class:ByteIndexer
Returnsarray/buffer[index(i, j)]
- Specified by:
get
in classByteIndexer
-
get
public ByteIndexer get(long i, long j, byte[] b, int offset, int length)
Description copied from class:ByteIndexer
Returnsthis
whereb[offset:offset + length] = array/buffer[index(i, j)]
- Specified by:
get
in classByteIndexer
-
get
public byte get(long i, long j, long k)
Description copied from class:ByteIndexer
Returnsarray/buffer[index(i, j, k)]
- Specified by:
get
in classByteIndexer
-
get
public byte get(long... indices)
Description copied from class:ByteIndexer
Returnsarray/buffer[index(indices)]
- Specified by:
get
in classByteIndexer
-
get
public ByteIndexer get(long[] indices, byte[] b, int offset, int length)
Description copied from class:ByteIndexer
Returnsthis
whereb[offset:offset + length] = array/buffer[index(indices)]
- Specified by:
get
in classByteIndexer
-
put
public ByteIndexer put(long i, byte b)
Description copied from class:ByteIndexer
Returnsthis
wherearray/buffer[index(i)] = b
- Specified by:
put
in classByteIndexer
-
put
public ByteIndexer put(long i, byte[] b, int offset, int length)
Description copied from class:ByteIndexer
Returnsthis
wherearray/buffer[index(i)] = b[offset:offset + length]
- Specified by:
put
in classByteIndexer
-
put
public ByteIndexer put(long i, long j, byte b)
Description copied from class:ByteIndexer
Returnsthis
wherearray/buffer[index(i, j)] = b
- Specified by:
put
in classByteIndexer
-
put
public ByteIndexer put(long i, long j, byte[] b, int offset, int length)
Description copied from class:ByteIndexer
Returnsthis
wherearray/buffer[index(i, j)] = b[offset:offset + length]
- Specified by:
put
in classByteIndexer
-
put
public ByteIndexer put(long i, long j, long k, byte b)
Description copied from class:ByteIndexer
Returnsthis
wherearray/buffer[index(i, j, k)] = b
- Specified by:
put
in classByteIndexer
-
put
public ByteIndexer put(long[] indices, byte b)
Description copied from class:ByteIndexer
Returnsthis
wherearray/buffer[index(indices)] = b
- Specified by:
put
in classByteIndexer
-
put
public ByteIndexer put(long[] indices, byte[] b, int offset, int length)
Description copied from class:ByteIndexer
Returnsthis
wherearray/buffer[index(indices)] = b[offset:offset + length]
- Specified by:
put
in classByteIndexer
-
getBuffer
java.nio.ByteBuffer getBuffer()
-
getByte
public byte getByte(long i)
Description copied from class:ByteIndexer
Returns thebyte
value atarray/buffer[i]
- Specified by:
getByte
in classByteIndexer
-
putByte
public ByteIndexer putByte(long i, byte b)
Description copied from class:ByteIndexer
Sets thebyte
value atarray/buffer[i]
- Specified by:
putByte
in classByteIndexer
-
getShort
public short getShort(long i)
Description copied from class:ByteIndexer
Returns theshort
value atarray/buffer[i]
- Specified by:
getShort
in classByteIndexer
-
putShort
public ByteIndexer putShort(long i, short s)
Description copied from class:ByteIndexer
Sets theshort
value atarray/buffer[i]
- Specified by:
putShort
in classByteIndexer
-
getInt
public int getInt(long i)
Description copied from class:ByteIndexer
Returns theint
value atarray/buffer[i]
- Specified by:
getInt
in classByteIndexer
-
putInt
public ByteIndexer putInt(long i, int j)
Description copied from class:ByteIndexer
Sets theint
value atarray/buffer[i]
- Specified by:
putInt
in classByteIndexer
-
getLong
public long getLong(long i)
Description copied from class:ByteIndexer
Returns thelong
value atarray/buffer[i]
- Specified by:
getLong
in classByteIndexer
-
putLong
public ByteIndexer putLong(long i, long j)
Description copied from class:ByteIndexer
Sets thelong
value atarray/buffer[i]
- Specified by:
putLong
in classByteIndexer
-
getFloat
public float getFloat(long i)
Description copied from class:ByteIndexer
Returns thefloat
value atarray/buffer[i]
- Specified by:
getFloat
in classByteIndexer
-
putFloat
public ByteIndexer putFloat(long i, float f)
Description copied from class:ByteIndexer
Sets thefloat
value atarray/buffer[i]
- Specified by:
putFloat
in classByteIndexer
-
getDouble
public double getDouble(long i)
Description copied from class:ByteIndexer
Returns thedouble
value atarray/buffer[i]
- Specified by:
getDouble
in classByteIndexer
-
putDouble
public ByteIndexer putDouble(long i, double d)
Description copied from class:ByteIndexer
Sets thedouble
value atarray/buffer[i]
- Specified by:
putDouble
in classByteIndexer
-
getChar
public char getChar(long i)
Description copied from class:ByteIndexer
Returns thechar
value atarray/buffer[i]
- Specified by:
getChar
in classByteIndexer
-
putChar
public ByteIndexer putChar(long i, char c)
Description copied from class:ByteIndexer
Sets thechar
value atarray/buffer[i]
- Specified by:
putChar
in classByteIndexer
-
-