public class ByteBufferIndexer extends ByteIndexer
ByteBuffer
.Modifier and Type | Field and Description |
---|---|
protected ByteBuffer |
buffer
The backing buffer.
|
VALUE_BYTES
indexable, ONE_STRIDE, sizes, strides
Constructor and Description |
---|
ByteBufferIndexer(ByteBuffer buffer)
Calls
ByteBufferIndexer(buffer, { buffer.limit() }, { 1 }) . |
ByteBufferIndexer(ByteBuffer buffer,
long... sizes)
Calls
ByteBufferIndexer(buffer, sizes, strides(sizes)) . |
ByteBufferIndexer(ByteBuffer buffer,
long[] sizes,
long[] strides)
|
Modifier and Type | Method and Description |
---|---|
Buffer |
buffer()
Returns the backing buffer, or
null if none |
byte |
get(long... indices)
Returns
array/buffer[index(indices)] |
byte |
get(long i)
Returns
array/buffer[i] |
ByteIndexer |
get(long[] indices,
byte[] b,
int offset,
int length)
Returns
this where b[offset:offset + length] = array/buffer[index(indices)] |
ByteIndexer |
get(long i,
byte[] b,
int offset,
int length)
Returns
this where b[offset:offset + length] = array/buffer[i] |
byte |
get(long i,
long j)
Returns
array/buffer[i * strides[0] + j] |
ByteIndexer |
get(long i,
long j,
byte[] b,
int offset,
int length)
Returns
this where b[offset:offset + length] = array/buffer[i * strides[0] + j] |
byte |
get(long i,
long j,
long k)
Returns
array/buffer[i * strides[0] + j * strides[1] + k] |
char |
getChar(long i)
Returns the
char value at array/buffer[i] |
double |
getDouble(long i)
Returns the
double value at array/buffer[i] |
float |
getFloat(long i)
Returns the
float value at array/buffer[i] |
int |
getInt(long i)
Returns the
int value at array/buffer[i] |
long |
getLong(long i)
Returns the
long value at array/buffer[i] |
short |
getShort(long i)
Returns the
short value at array/buffer[i] |
ByteIndexer |
put(long[] indices,
byte b)
Returns
this where array/buffer[index(indices)] = b |
ByteIndexer |
put(long[] indices,
byte[] b,
int offset,
int length)
Returns
this where array/buffer[index(indices)] = b[offset:offset + length] |
ByteIndexer |
put(long i,
byte b)
Returns
this where array/buffer[i] = b |
ByteIndexer |
put(long i,
byte[] b,
int offset,
int length)
Returns
this where array/buffer[i] = b[offset:offset + length] |
ByteIndexer |
put(long i,
long j,
byte b)
Returns
this where array/buffer[i * strides[0] + j] = b |
ByteIndexer |
put(long i,
long j,
byte[] b,
int offset,
int length)
Returns
this where array/buffer[i * strides[0] + j] = b[offset:offset + length] |
ByteIndexer |
put(long i,
long j,
long k,
byte b)
Returns
this where array/buffer[i * strides[0] + j * strides[1] + k] = b |
ByteIndexer |
putChar(long i,
char c)
Sets the
char value at array/buffer[i] |
ByteIndexer |
putDouble(long i,
double d)
Sets the
double value at array/buffer[i] |
ByteIndexer |
putFloat(long i,
float f)
Sets the
float value at array/buffer[i] |
ByteIndexer |
putInt(long i,
int j)
Sets the
int value at array/buffer[i] |
ByteIndexer |
putLong(long i,
long j)
Sets the
long value at array/buffer[i] |
ByteIndexer |
putShort(long i,
short s)
Sets the
short value at array/buffer[i] |
void |
release()
Makes sure changes are reflected onto the backing memory and clears any references.
|
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
protected ByteBuffer buffer
public ByteBufferIndexer(ByteBuffer buffer)
ByteBufferIndexer(buffer, { buffer.limit() }, { 1 })
.public ByteBufferIndexer(ByteBuffer buffer, long... sizes)
ByteBufferIndexer(buffer, sizes, strides(sizes))
.public ByteBufferIndexer(ByteBuffer buffer, long[] sizes, long[] strides)
public Buffer buffer()
Indexer
null
if nonepublic byte get(long i)
ByteIndexer
array/buffer[i]
get
in class ByteIndexer
public ByteIndexer get(long i, byte[] b, int offset, int length)
ByteIndexer
this
where b[offset:offset + length] = array/buffer[i]
get
in class ByteIndexer
public byte get(long i, long j)
ByteIndexer
array/buffer[i * strides[0] + j]
get
in class ByteIndexer
public ByteIndexer get(long i, long j, byte[] b, int offset, int length)
ByteIndexer
this
where b[offset:offset + length] = array/buffer[i * strides[0] + j]
get
in class ByteIndexer
public byte get(long i, long j, long k)
ByteIndexer
array/buffer[i * strides[0] + j * strides[1] + k]
get
in class ByteIndexer
public byte get(long... indices)
ByteIndexer
array/buffer[index(indices)]
get
in class ByteIndexer
public ByteIndexer get(long[] indices, byte[] b, int offset, int length)
ByteIndexer
this
where b[offset:offset + length] = array/buffer[index(indices)]
get
in class ByteIndexer
public ByteIndexer put(long i, byte b)
ByteIndexer
this
where array/buffer[i] = b
put
in class ByteIndexer
public ByteIndexer put(long i, byte[] b, int offset, int length)
ByteIndexer
this
where array/buffer[i] = b[offset:offset + length]
put
in class ByteIndexer
public ByteIndexer put(long i, long j, byte b)
ByteIndexer
this
where array/buffer[i * strides[0] + j] = b
put
in class ByteIndexer
public ByteIndexer put(long i, long j, byte[] b, int offset, int length)
ByteIndexer
this
where array/buffer[i * strides[0] + j] = b[offset:offset + length]
put
in class ByteIndexer
public ByteIndexer put(long i, long j, long k, byte b)
ByteIndexer
this
where array/buffer[i * strides[0] + j * strides[1] + k] = b
put
in class ByteIndexer
public ByteIndexer put(long[] indices, byte b)
ByteIndexer
this
where array/buffer[index(indices)] = b
put
in class ByteIndexer
public ByteIndexer put(long[] indices, byte[] b, int offset, int length)
ByteIndexer
this
where array/buffer[index(indices)] = b[offset:offset + length]
put
in class ByteIndexer
public short getShort(long i)
ByteIndexer
short
value at array/buffer[i]
getShort
in class ByteIndexer
public ByteIndexer putShort(long i, short s)
ByteIndexer
short
value at array/buffer[i]
putShort
in class ByteIndexer
public int getInt(long i)
ByteIndexer
int
value at array/buffer[i]
getInt
in class ByteIndexer
public ByteIndexer putInt(long i, int j)
ByteIndexer
int
value at array/buffer[i]
putInt
in class ByteIndexer
public long getLong(long i)
ByteIndexer
long
value at array/buffer[i]
getLong
in class ByteIndexer
public ByteIndexer putLong(long i, long j)
ByteIndexer
long
value at array/buffer[i]
putLong
in class ByteIndexer
public float getFloat(long i)
ByteIndexer
float
value at array/buffer[i]
getFloat
in class ByteIndexer
public ByteIndexer putFloat(long i, float f)
ByteIndexer
float
value at array/buffer[i]
putFloat
in class ByteIndexer
public double getDouble(long i)
ByteIndexer
double
value at array/buffer[i]
getDouble
in class ByteIndexer
public ByteIndexer putDouble(long i, double d)
ByteIndexer
double
value at array/buffer[i]
putDouble
in class ByteIndexer
public char getChar(long i)
ByteIndexer
char
value at array/buffer[i]
getChar
in class ByteIndexer
public ByteIndexer putChar(long i, char c)
ByteIndexer
char
value at array/buffer[i]
putChar
in class ByteIndexer
Copyright © 2020. All rights reserved.