public abstract class BaseDataBuffer extends Object implements DataBuffer
DataBuffer.AllocationMode, DataBuffer.Type| Modifier and Type | Field and Description |
|---|---|
protected DataBuffer.AllocationMode |
allocationMode |
protected AtomicBoolean |
dirty |
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 |
protected ByteBuffer |
wrappedBuffer |
| Modifier | Constructor and Description |
|---|---|
|
BaseDataBuffer(byte[] data,
int length) |
|
BaseDataBuffer(ByteBuffer buffer,
int length)
Create a data buffer from
the given 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
|
void |
copyAtStride(DataBuffer buf,
int n,
int stride,
int yStride,
int offset,
int yOffset)
Copies from
the given buffer
at the specified stride
for up to n elements
|
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
|
boolean |
dirty()
Whether the buffer is dirty:
aka has been updated
|
protected void |
doReadObject(ObjectInputStream s) |
DataBuffer |
dup()
Return a copy of this buffer
|
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
|
protected void |
setNioBuffer() |
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, waitdataType, getElementSizeprotected int length
protected int elementSize
protected transient ByteBuffer wrappedBuffer
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 AtomicBoolean dirty
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(ByteBuffer buffer, int length)
buffer - length - public BaseDataBuffer(byte[] data,
int length)
protected BaseDataBuffer(int length)
length - the length of the bufferprotected void setNioBuffer()
public DataBuffer.AllocationMode allocationMode()
DataBufferallocationMode in interface DataBufferpublic void persist()
DataBufferpersist in interface DataBufferpublic boolean isPersist()
DataBufferisPersist in interface DataBufferpublic void unPersist()
DataBufferunPersist in interface DataBufferpublic void copyAtStride(DataBuffer buf, int n, int stride, int yStride, int offset, int yOffset)
DataBuffercopyAtStride in interface DataBufferbuf - the data buffer to copy fromn - the number of elements to copystride - the stride to copy atpublic void removeReferencing(String id)
DataBufferremoveReferencing in interface DataBufferid - the id to removepublic Collection<String> references()
DataBufferreferences in interface DataBufferpublic void addReferencing(String id)
DataBufferaddReferencing in interface DataBufferid - the id to referencepublic void assign(int[] indices,
float[] data,
boolean contiguous,
int inc)
DataBufferassign in interface DataBufferindices - 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)
DataBuffersetData in interface DataBufferdata - the data for this bufferpublic void setData(float[] data)
DataBuffersetData in interface DataBufferdata - the data for this bufferpublic void setData(double[] data)
DataBuffersetData in interface DataBufferdata - the data for this bufferpublic void assign(int[] indices,
double[] data,
boolean contiguous,
int inc)
DataBufferassign in interface DataBufferindices - 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)
DataBufferassign in interface DataBufferdata - the data to assignpublic void assign(int[] indices,
float[] data,
boolean contiguous)
DataBufferassign in interface DataBufferindices - the indices to assigndata - the data to assigncontiguous - whether the indices are contiguous or notpublic void assign(int[] indices,
double[] data,
boolean contiguous)
DataBufferassign in interface DataBufferindices - the indices to assigndata - the data to assigncontiguous - whether the data is contiguous or notpublic int length()
DataBufferlength in interface DataBufferpublic void assign(Number value)
DataBufferassign in interface DataBuffervalue - the value to assignpublic double[] getDoublesAt(int offset,
int length)
DataBuffergetDoublesAt in interface DataBufferoffset - the offset to startlength - the length of the arraypublic float[] getFloatsAt(int offset,
int inc,
int length)
DataBuffergetFloatsAt in interface DataBufferoffset - the offset to startinc - the increment to uselength - the length of the arraypublic DataBuffer dup()
DataBufferdup in interface DataBufferprotected 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)
DataBuffergetDoublesAt in interface DataBufferoffset - the offset to startinc - the increment to uselength - the length of the arraypublic float[] getFloatsAt(int offset,
int length)
DataBuffergetFloatsAt in interface DataBufferoffset - the offset to startlength - the length of the arraypublic IComplexFloat getComplexFloat(int i)
DataBuffergetComplexFloat in interface DataBufferi - the i togetepublic IComplexDouble getComplexDouble(int i)
DataBuffergetComplexDouble in interface DataBufferi - the indexpublic IComplexNumber getComplex(int i)
DataBuffergetComplex in interface DataBufferi - the complex number cto getpublic void put(int i,
IComplexNumber result)
DataBufferput in interface DataBufferi - the index to insertresult - the element to insertpublic void assign(int[] offsets,
int[] strides,
DataBuffer... buffers)
DataBufferassign in interface DataBufferoffsets - the offsets to usestrides - the strides to usebuffers - the buffers to assign data frompublic byte[] asBytes()
DataBufferasBytes in interface DataBufferpublic float[] asFloat()
DataBufferasFloat in interface DataBufferpublic double[] asDouble()
DataBufferasDouble in interface DataBufferpublic int[] asInt()
DataBufferasInt in interface DataBufferpublic double getDouble(int i)
DataBuffergetDouble in interface DataBufferi - the element to getFloatpublic float getFloat(int i)
DataBuffergetFloat in interface DataBufferi - the element to getFloatpublic Number getNumber(int i)
DataBuffergetNumber in interface DataBufferi - the element to getFloatpublic void put(int i,
float element)
DataBufferput in interface DataBufferi - the indexelement - the element to assignpublic void put(int i,
double element)
DataBufferput in interface DataBufferi - the indexelement - the element to assignpublic boolean dirty()
DataBufferdirty in interface DataBufferpublic DoubleBuffer asNioDouble()
DataBufferasNioDouble in interface DataBufferpublic FloatBuffer asNioFloat()
DataBufferasNioFloat in interface DataBufferpublic ByteBuffer asNio()
DataBufferasNio in interface DataBufferpublic io.netty.buffer.ByteBuf asNetty()
DataBufferasNetty in interface DataBufferpublic void put(int i,
int element)
DataBufferput in interface DataBufferi - the indexelement - the element to assignpublic void assign(Number value, int offset)
DataBufferassign in interface DataBuffervalue - assign the value to setoffset - the offset to start atpublic void write(OutputStream dos)
DataBufferwrite in interface DataBufferdos - the output stream to writepublic void read(InputStream is)
DataBufferread in interface DataBufferis - the inpus tream to write topublic void flush()
DataBufferflush in interface DataBufferpublic int getInt(int ix)
DataBuffergetInt in interface DataBufferix - the int at the specified indexpublic void assign(int[] offsets,
int[] strides,
long n,
DataBuffer... buffers)
DataBufferassign in interface DataBufferoffsets - 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)
DataBufferassign in interface DataBufferbuffers - the buffers to assignpublic void destroy()
DataBufferdestroy in interface DataBufferprotected void doReadObject(ObjectInputStream s)
protected void read(DataInputStream s)
protected void write(DataOutputStream out) throws IOException
IOExceptionpublic Object array()
DataBufferarray in interface DataBufferCopyright © 2016. All Rights Reserved.