DataBufferByte
, DataBufferDouble
, DataBufferFloat
, DataBufferInt
, DataBufferShort
, DataBufferUShort
public abstract class DataBuffer extends Object
Modifier and Type | Field | Description |
---|---|---|
protected int |
banks |
The number of banks in this DataBuffer. |
protected int |
dataType |
The data type of this DataBuffer. |
protected int |
offset |
Offset into default (first) bank from which to get the first element. |
protected int[] |
offsets |
Offsets into all banks. |
protected int |
size |
Usable size of all banks. |
static final int |
TYPE_BYTE |
Tag for unsigned byte data. |
static final int |
TYPE_DOUBLE |
Tag for double data. |
static final int |
TYPE_FLOAT |
Tag for float data. |
static final int |
TYPE_INT |
Tag for int data. |
static final int |
TYPE_SHORT |
Tag for signed short data. |
static final int |
TYPE_UNDEFINED |
Tag for undefined data. |
static final int |
TYPE_USHORT |
Tag for unsigned short data. |
Modifier | Constructor | Description |
---|---|---|
protected |
Constructs a DataBuffer containing one bank of the specified data type and size. |
|
protected |
Constructs a DataBuffer containing the specified number of banks. |
|
protected |
Constructs a DataBuffer that contains the specified number of banks. |
|
protected |
Constructs a DataBuffer which contains the specified number of banks. |
Modifier and Type | Method | Description |
---|---|---|
int |
getDataType() |
Returns the data type of this DataBuffer. |
static int |
getDataTypeSize |
Returns the size (in bits) of the data type, given a datatype tag. |
int |
getElem |
Returns the requested data array element from the first (default) bank as an integer. |
abstract int |
getElem |
Returns the requested data array element from the specified bank as an integer. |
double |
getElemDouble |
Returns the requested data array element from the first (default) bank as a double. |
double |
getElemDouble |
Returns the requested data array element from the specified bank as a double. |
float |
getElemFloat |
Returns the requested data array element from the first (default) bank as a float. |
float |
getElemFloat |
Returns the requested data array element from the specified bank as a float. |
int |
getNumBanks() |
Returns the number of banks in this DataBuffer. |
int |
getOffset() |
Returns the offset of the default bank in array elements. |
int[] |
getOffsets() |
Returns the offsets (in array elements) of all the banks. |
int |
getSize() |
Returns the size (in array elements) of all banks. |
void |
setElem |
Sets the requested data array element in the first (default) bank from the given integer. |
abstract void |
setElem |
Sets the requested data array element in the specified bank from the given integer. |
void |
setElemDouble |
Sets the requested data array element in the first (default) bank from the given double. |
void |
setElemDouble |
Sets the requested data array element in the specified bank from the given double. |
void |
setElemFloat |
Sets the requested data array element in the first (default) bank from the given float. |
void |
setElemFloat |
Sets the requested data array element in the specified bank from the given float. |
@Native public static final int TYPE_BYTE
@Native public static final int TYPE_USHORT
@Native public static final int TYPE_SHORT
@Native public static final int TYPE_INT
@Native public static final int TYPE_FLOAT
@Native public static final int TYPE_DOUBLE
@Native public static final int TYPE_UNDEFINED
protected int dataType
protected int banks
protected int offset
protected int size
protected int[] offsets
protected DataBuffer(int dataType, int size)
dataType
- the data type of this DataBuffer
size
- the size of the banksprotected DataBuffer(int dataType, int size, int numBanks)
dataType
- the data type of this DataBuffer
size
- the size of the banksnumBanks
- the number of banks in this DataBuffer
protected DataBuffer(int dataType, int size, int numBanks, int offset)
dataType
- the data type of this DataBuffer
size
- the size of the banksnumBanks
- the number of banks in this DataBuffer
offset
- the offset for each bankprotected DataBuffer(int dataType, int size, int numBanks, int[] offsets)
dataType
- the data type of this DataBuffer
size
- the size of the banksnumBanks
- the number of banks in this DataBuffer
offsets
- an array containing an offset for each bank.ArrayIndexOutOfBoundsException
- if numBanks
does not equal the length of offsets
public static int getDataTypeSize(int type)
type
- the value of one of the defined datatype tagsIllegalArgumentException
- if type
is less than zero or greater than TYPE_DOUBLE
public int getDataType()
DataBuffer
.public int getSize()
public int getOffset()
public int[] getOffsets()
public int getNumBanks()
public int getElem(int i)
i
- the index of the requested data array elementpublic abstract int getElem(int bank, int i)
bank
- the specified banki
- the index of the requested data array elementpublic void setElem(int i, int val)
i
- the specified index into the data arrayval
- the data to set the element at the specified index in the data arraypublic abstract void setElem(int bank, int i, int val)
bank
- the specified banki
- the specified index into the data arrayval
- the data to set the element in the specified bank at the specified index in the data arraypublic float getElemFloat(int i)
i
- the index of the requested data array elementpublic float getElemFloat(int bank, int i)
getElem(int, int)
to a float. Subclasses can override this method if another implementation is needed.bank
- the specified banki
- the index of the requested data array elementpublic void setElemFloat(int i, float val)
setElem(int, int)
. Subclasses can override this method if another implementation is needed.i
- the specified indexval
- the value to set the element at the specified index in the data arraypublic void setElemFloat(int bank, int i, float val)
setElem(int, int)
. Subclasses can override this method if another implementation is needed.bank
- the specified banki
- the specified indexval
- the value to set the element in the specified bank at the specified index in the data arraypublic double getElemDouble(int i)
getElem(int)
to a double. Subclasses can override this method if another implementation is needed.i
- the specified indexpublic double getElemDouble(int bank, int i)
bank
- the specified banki
- the specified indexpublic void setElemDouble(int i, double val)
setElem(int, int)
. Subclasses can override this method if another implementation is needed.i
- the specified indexval
- the value to set the element at the specified index in the data arraypublic void setElemDouble(int bank, int i, double val)
setElem(int, int)
. Subclasses can override this method if another implementation is needed.bank
- the specified banki
- the specified indexval
- the value to set the element in the specified bank at the specified index of the data array
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/java/awt/image/DataBuffer.html