public abstract class BaseDataBuffer extends Object implements DataBuffer
DataBuffer.AllocationMode, DataBuffer.Type
Modifier and Type | Field and Description |
---|---|
protected DataBuffer.AllocationMode |
allocationMode |
protected io.netty.buffer.ByteBuf |
dataBuffer |
protected double[] |
doubleData |
protected int |
elementSize |
protected float[] |
floatData |
protected int[] |
intData |
protected boolean |
isPersist |
protected int |
length |
protected WeakReference<DataBuffer> |
ref |
protected Collection<String> |
referencing |
Modifier | Constructor and Description |
---|---|
|
BaseDataBuffer(byte[] data,
int length) |
protected |
BaseDataBuffer(io.netty.buffer.ByteBuf buf,
int length) |
|
BaseDataBuffer(double[] data) |
|
BaseDataBuffer(double[] data,
boolean copy) |
|
BaseDataBuffer(float[] data) |
|
BaseDataBuffer(float[] data,
boolean copy) |
protected |
BaseDataBuffer(int length)
Instantiate a buffer with the given length
|
|
BaseDataBuffer(int[] data) |
|
BaseDataBuffer(int[] data,
boolean copy) |
|
BaseDataBuffer(int length,
int elementSize) |
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
|
abstract DataBuffer |
create(io.netty.buffer.ByteBuf buf,
int length)
Create the data buffer
with respect to the given byte buffer
|
abstract DataBuffer |
create(double[] data)
Create the data buffer
with respect to the given byte buffer
|
abstract DataBuffer |
create(float[] data)
Create the data buffer
with respect to the given byte buffer
|
protected abstract DataBuffer |
create(int length)
Create with length
|
abstract DataBuffer |
create(int[] data)
Create the data buffer
with respect to the given byte buffer
|
void |
destroy()
release all resources for this buffer
|
protected void |
doReadObject(ObjectInputStream s) |
DataBuffer |
dup()
Return a copy of this buffer
|
protected void |
ensureWritable(int pos,
int len) |
boolean |
equals(Object o) |
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
|
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
|
int |
hashCode() |
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
|
protected void |
read(DataInputStream s) |
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
|
String |
toString() |
void |
unPersist()
Un persist the buffer
|
protected void |
write(DataOutputStream out) |
void |
write(OutputStream dos)
Write this buffer to the output stream
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
dataType, getElementSize
protected int length
protected int elementSize
protected transient io.netty.buffer.ByteBuf dataBuffer
protected Collection<String> referencing
protected transient WeakReference<DataBuffer> ref
protected boolean isPersist
protected DataBuffer.AllocationMode allocationMode
protected double[] doubleData
protected int[] intData
protected float[] floatData
protected BaseDataBuffer(io.netty.buffer.ByteBuf buf, int length)
buf
- length
- public BaseDataBuffer(float[] data, boolean copy)
data
- copy
- public BaseDataBuffer(double[] data, boolean copy)
data
- copy
- public BaseDataBuffer(int[] data, boolean copy)
data
- copy
- public BaseDataBuffer(double[] data)
public BaseDataBuffer(int[] data)
public BaseDataBuffer(float[] data)
public BaseDataBuffer(int length, int elementSize)
public BaseDataBuffer(byte[] data, int length)
protected BaseDataBuffer(int length)
length
- the length of the bufferpublic DataBuffer.AllocationMode allocationMode()
DataBuffer
allocationMode
in interface DataBuffer
public void persist()
DataBuffer
persist
in interface DataBuffer
public boolean isPersist()
DataBuffer
isPersist
in interface DataBuffer
public void unPersist()
DataBuffer
unPersist
in interface DataBuffer
public void removeReferencing(String id)
DataBuffer
removeReferencing
in interface DataBuffer
id
- the id to removepublic Collection<String> references()
DataBuffer
references
in interface DataBuffer
public void addReferencing(String id)
DataBuffer
addReferencing
in interface DataBuffer
id
- the id to referencepublic void assign(int[] indices, float[] data, boolean contiguous, int inc)
DataBuffer
assign
in interface DataBuffer
indices
- the indices to assigndata
- the data to assigncontiguous
- whether the indices are contiguous or notinc
- the number to increment by when assigningpublic void setData(int[] data)
DataBuffer
setData
in interface DataBuffer
data
- the data for this bufferpublic void setData(float[] data)
DataBuffer
setData
in interface DataBuffer
data
- the data for this bufferpublic void setData(double[] data)
DataBuffer
setData
in interface DataBuffer
data
- the data for this bufferpublic void assign(int[] indices, double[] data, boolean contiguous, int inc)
DataBuffer
assign
in interface DataBuffer
indices
- the indices to assigndata
- the data to assigncontiguous
- whether the data is contiguous or notinc
- the number to increment by when assigningpublic void assign(DataBuffer data)
DataBuffer
assign
in interface DataBuffer
data
- the data to assignpublic void assign(int[] indices, float[] data, boolean contiguous)
DataBuffer
assign
in interface DataBuffer
indices
- the indices to assigndata
- the data to assigncontiguous
- whether the indices are contiguous or notpublic void assign(int[] indices, double[] data, boolean contiguous)
DataBuffer
assign
in interface DataBuffer
indices
- the indices to assigndata
- the data to assigncontiguous
- whether the data is contiguous or notpublic int length()
DataBuffer
length
in interface DataBuffer
public void assign(Number value)
DataBuffer
assign
in interface DataBuffer
value
- the value to assignpublic double[] getDoublesAt(int offset, int length)
DataBuffer
getDoublesAt
in interface DataBuffer
offset
- the offset to startlength
- the length of the arraypublic float[] getFloatsAt(int offset, int inc, int length)
DataBuffer
getFloatsAt
in interface DataBuffer
offset
- the offset to startinc
- the increment to uselength
- the length of the arraypublic DataBuffer dup()
DataBuffer
dup
in interface DataBuffer
protected abstract DataBuffer create(int length)
length
- a databuffer of the same type as
this with the given lengthpublic abstract DataBuffer create(double[] data)
data
- the buffer to createpublic abstract DataBuffer create(float[] data)
data
- the buffer to createpublic abstract DataBuffer create(int[] data)
data
- the buffer to createpublic abstract DataBuffer create(io.netty.buffer.ByteBuf buf, int length)
buf
- the buffer to createpublic double[] getDoublesAt(int offset, int inc, int length)
DataBuffer
getDoublesAt
in interface DataBuffer
offset
- the offset to startinc
- the increment to uselength
- the length of the arraypublic float[] getFloatsAt(int offset, int length)
DataBuffer
getFloatsAt
in interface DataBuffer
offset
- the offset to startlength
- the length of the arraypublic IComplexFloat getComplexFloat(int i)
DataBuffer
getComplexFloat
in interface DataBuffer
i
- the i togetepublic IComplexDouble getComplexDouble(int i)
DataBuffer
getComplexDouble
in interface DataBuffer
i
- the indexpublic IComplexNumber getComplex(int i)
DataBuffer
getComplex
in interface DataBuffer
i
- the complex number cto getpublic void put(int i, IComplexNumber result)
DataBuffer
put
in interface DataBuffer
i
- the index to insertresult
- the element to insertpublic void assign(int[] offsets, int[] strides, DataBuffer... buffers)
DataBuffer
assign
in interface DataBuffer
offsets
- the offsets to usestrides
- the strides to usebuffers
- the buffers to assign data frompublic byte[] asBytes()
DataBuffer
asBytes
in interface DataBuffer
public float[] asFloat()
DataBuffer
asFloat
in interface DataBuffer
public double[] asDouble()
DataBuffer
asDouble
in interface DataBuffer
public int[] asInt()
DataBuffer
asInt
in interface DataBuffer
public double getDouble(int i)
DataBuffer
getDouble
in interface DataBuffer
i
- the element to getFloatpublic float getFloat(int i)
DataBuffer
getFloat
in interface DataBuffer
i
- the element to getFloatpublic Number getNumber(int i)
DataBuffer
getNumber
in interface DataBuffer
i
- the element to getFloatpublic void put(int i, float element)
DataBuffer
put
in interface DataBuffer
i
- the indexelement
- the element to assignpublic void put(int i, double element)
DataBuffer
put
in interface DataBuffer
i
- the indexelement
- the element to assignprotected void ensureWritable(int pos, int len)
public DoubleBuffer asNioDouble()
DataBuffer
asNioDouble
in interface DataBuffer
public FloatBuffer asNioFloat()
DataBuffer
asNioFloat
in interface DataBuffer
public ByteBuffer asNio()
DataBuffer
asNio
in interface DataBuffer
public io.netty.buffer.ByteBuf asNetty()
DataBuffer
asNetty
in interface DataBuffer
public void put(int i, int element)
DataBuffer
put
in interface DataBuffer
i
- the indexelement
- the element to assignpublic void assign(Number value, int offset)
DataBuffer
assign
in interface DataBuffer
value
- assign the value to setoffset
- the offset to start atpublic void write(OutputStream dos)
DataBuffer
write
in interface DataBuffer
dos
- the output stream to writepublic void read(InputStream is)
DataBuffer
read
in interface DataBuffer
is
- the inpus tream to write topublic void flush()
DataBuffer
flush
in interface DataBuffer
public int getInt(int ix)
DataBuffer
getInt
in interface DataBuffer
ix
- the int at the specified indexpublic void assign(int[] offsets, int[] strides, long n, DataBuffer... buffers)
DataBuffer
assign
in interface DataBuffer
offsets
- the offsets to usestrides
- the strides to usen
- the number of elements to operate onbuffers
- the buffers to assign data frompublic void assign(DataBuffer... buffers)
DataBuffer
assign
in interface DataBuffer
buffers
- the buffers to assignpublic void destroy()
DataBuffer
destroy
in interface DataBuffer
protected void doReadObject(ObjectInputStream s)
protected void read(DataInputStream s)
protected void write(DataOutputStream out) throws IOException
IOException
public Object array()
DataBuffer
array
in interface DataBuffer
Copyright © 2015. All Rights Reserved.