public interface DataBuffer extends Serializable
Modifier and Type | Interface and Description |
---|---|
static class |
DataBuffer.AllocationMode
Direct (off heap) and heap allocation
Each has their trade offs.
|
static class |
DataBuffer.Type |
Modifier and Type | Method and Description |
---|---|
void |
addReferencing(String id)
Add a referencing element to this buffer
|
DataBuffer.AllocationMode |
allocationMode()
Allocation mode for buffers
|
Object |
array()
Returns the backing array
of this buffer (if there is one)
|
byte[] |
asBytes()
Raw byte array storage
|
double[] |
asDouble()
Return the buffer as a double array
Relative to the datatype, this will either be a copy
or a reference.
|
float[] |
asFloat()
Return the buffer as a float array
Relative to the datatype, this will either be a copy
or a reference.
|
int[] |
asInt()
Return the buffer as an int array
Relative to the datatype, this will either be a copy
or a reference.
|
io.netty.buffer.ByteBuf |
asNetty()
Returns a view of this as a
netty byte buffer
|
ByteBuffer |
asNio()
Returns a view of this as an
nio byte buffer
|
DoubleBuffer |
asNioDouble()
Returns a view of this as an
nio byte buffer
|
FloatBuffer |
asNioFloat()
Returns a view of this as an
nio byte buffer
|
void |
assign(DataBuffer... buffers)
Assign the given data buffers to this buffer
|
void |
assign(DataBuffer data)
Assign the contents of this buffer
to this buffer
|
void |
assign(int[] indices,
double[] data,
boolean contiguous)
Assign the given elements to the given indices
|
void |
assign(int[] indices,
double[] data,
boolean contiguous,
int inc)
Assign the given elements to the given indices
|
void |
assign(int[] indices,
float[] data,
boolean contiguous)
Assign the given elements to the given indices
|
void |
assign(int[] indices,
float[] data,
boolean contiguous,
int inc)
Assign the given elements to the given indices
|
void |
assign(int[] offsets,
int[] strides,
DataBuffer... buffers)
Assign the given buffers to this buffer
based on the given offsets and strides.
|
void |
assign(int[] offsets,
int[] strides,
long n,
DataBuffer... buffers)
Assign the given buffers to this buffer
based on the given offsets and strides.
|
void |
assign(Number value)
Assign the given value to the buffer
|
void |
assign(Number value,
int offset)
Assign the given value to the buffer
starting at offset
|
DataBuffer.Type |
dataType()
The data type of the buffer
|
void |
destroy()
release all resources for this buffer
|
DataBuffer |
dup()
Return a copy of this buffer
|
void |
flush()
Flush the data buffer
|
IComplexNumber |
getComplex(int i)
Returns a complex number
|
IComplexDouble |
getComplexDouble(int i)
Get the complex double at the specified index
|
IComplexFloat |
getComplexFloat(int i)
Get the complex float
|
double |
getDouble(int i)
Get element i in the buffer as a double
|
double[] |
getDoublesAt(int offset,
int length)
Get the doubles at a particular offset
|
double[] |
getDoublesAt(int offset,
int inc,
int length)
Get the doubles at a particular offset
|
int |
getElementSize()
The number of bytes for each individual element
|
float |
getFloat(int i)
Get element i in the buffer as a double
|
float[] |
getFloatsAt(int offset,
int length)
Get the doubles at a particular offset
|
float[] |
getFloatsAt(int offset,
int inc,
int length)
Get the doubles at a particular offset
|
int |
getInt(int ix)
Get the int at the specified index
|
Number |
getNumber(int i)
Get element i in the buffer as a double
|
boolean |
isPersist()
Whether the buffer should be persistent.
|
int |
length()
Returns the length of the buffer
|
void |
persist()
Mark this buffer as persistent
|
void |
put(int i,
double element)
Assign an element in the buffer to the specified index
|
void |
put(int i,
float element)
Assign an element in the buffer to the specified index
|
void |
put(int i,
IComplexNumber result)
Insert a complex number at the given index
|
void |
put(int i,
int element)
Assign an element in the buffer to the specified index
|
void |
read(InputStream is)
Write this buffer to the input stream.
|
Collection<String> |
references()
The referencers pointing to this buffer
|
void |
removeReferencing(String id)
Remove the referenced id if it exists
|
void |
setData(double[] data)
Set the data for this buffer
|
void |
setData(float[] data)
Set the data for this buffer
|
void |
setData(int[] data)
Set the data for this buffer
|
void |
unPersist()
Un persist the buffer
|
void |
write(OutputStream dos)
Write this buffer to the output stream
|
Object array()
DoubleBuffer asNioDouble()
FloatBuffer asNioFloat()
ByteBuffer asNio()
io.netty.buffer.ByteBuf asNetty()
DataBuffer.AllocationMode allocationMode()
void persist()
boolean isPersist()
void unPersist()
int getElementSize()
void removeReferencing(String id)
id
- the id to removeCollection<String> references()
void addReferencing(String id)
id
- the id to referencevoid assign(int[] indices, float[] data, boolean contiguous, int inc)
indices
- the indices to assigndata
- the data to assigncontiguous
- whether the indices are contiguous or notinc
- the number to increment by when assigningvoid assign(int[] indices, double[] data, boolean contiguous, int inc)
indices
- the indices to assigndata
- the data to assigncontiguous
- whether the data is contiguous or notinc
- the number to increment by when assigningvoid assign(int[] indices, float[] data, boolean contiguous)
indices
- the indices to assigndata
- the data to assigncontiguous
- whether the indices are contiguous or notvoid assign(int[] indices, double[] data, boolean contiguous)
indices
- the indices to assigndata
- the data to assigncontiguous
- whether the data is contiguous or notdouble[] getDoublesAt(int offset, int length)
offset
- the offset to startlength
- the length of the arrayfloat[] getFloatsAt(int offset, int length)
offset
- the offset to startlength
- the length of the arraydouble[] getDoublesAt(int offset, int inc, int length)
offset
- the offset to startinc
- the increment to uselength
- the length of the arrayfloat[] getFloatsAt(int offset, int inc, int length)
offset
- the offset to startinc
- the increment to uselength
- the length of the arrayvoid assign(Number value)
value
- the value to assignvoid assign(Number value, int offset)
value
- assign the value to setoffset
- the offset to start atvoid setData(int[] data)
data
- the data for this buffervoid setData(float[] data)
data
- the data for this buffervoid setData(double[] data)
data
- the data for this bufferbyte[] asBytes()
DataBuffer.Type dataType()
float[] asFloat()
double[] asDouble()
int[] asInt()
double getDouble(int i)
i
- the element to getFloatfloat getFloat(int i)
i
- the element to getFloatNumber getNumber(int i)
i
- the element to getFloatvoid put(int i, float element)
i
- the indexelement
- the element to assignvoid put(int i, double element)
i
- the indexelement
- the element to assignvoid put(int i, int element)
i
- the indexelement
- the element to assignIComplexFloat getComplexFloat(int i)
i
- the i togeteIComplexDouble getComplexDouble(int i)
i
- the indexIComplexNumber getComplex(int i)
i
- the complex number cto getint length()
int getInt(int ix)
ix
- the int at the specified indexDataBuffer dup()
void flush()
void put(int i, IComplexNumber result)
i
- the index to insertresult
- the element to insertvoid assign(DataBuffer data)
data
- the data to assignvoid assign(int[] offsets, int[] strides, long n, DataBuffer... buffers)
offsets
- the offsets to usestrides
- the strides to usen
- the number of elements to operate onbuffers
- the buffers to assign data fromvoid assign(DataBuffer... buffers)
buffers
- the buffers to assignvoid assign(int[] offsets, int[] strides, DataBuffer... buffers)
offsets
- the offsets to usestrides
- the strides to usebuffers
- the buffers to assign data fromvoid destroy()
void write(OutputStream dos)
dos
- the output stream to writevoid read(InputStream is)
is
- the inpus tream to write toCopyright © 2015. All Rights Reserved.