|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object![]()
![]()
![]()
java.awt.image.DataBuffer
, DataBufferDouble
, DataBufferFloat
, DataBufferInt
, DataBufferShort
, DataBufferUShort

public abstract class DataBuffer

This class exists to wrap one or more data arrays. Each data array in the DataBuffer is referred to as a bank. Accessor methods for getting and setting elements of the DataBuffer's banks exist with and without a bank specifier. The methods without a bank specifier use the default 0th bank. The DataBuffer can optionally take an offset per bank, so that data in an existing array can be used even if the interesting data doesn't start at array location zero. Getting or setting the 0th element of a bank, uses the (0+offset)th element of the array. The size field specifies how much of the data array is available for use. Size + offset for a given bank should never be greater than the length of the associated data array. The data type of a data buffer indicates the type of the data array(s) and may also indicate additional semantics, e.g. storing unsigned 8-bit data in elements of a byte array. The data type may be TYPE_UNDEFINED or one of the types defined below. Other types may be added in the future. Generally, an object of class DataBuffer will be cast down to one of its data type specific subclasses to access data type specific methods for improved performance. Currently, the Java 2D(tm) API image classes use TYPE_BYTE, TYPE_USHORT, TYPE_INT, TYPE_SHORT, TYPE_FLOAT, and TYPE_DOUBLE DataBuffers to store image data.
Raster
,
SampleModel

| Field Summary | |
|---|---|
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 int |
TYPE_BYTE
Tag for unsigned byte data. |
static int |
TYPE_DOUBLE
Tag for double data. |
static int |
TYPE_FLOAT
Tag for float data. |
static int |
TYPE_INT
Tag for int data. |
static int |
TYPE_SHORT
Tag for signed short data. |
static int |
TYPE_UNDEFINED
Tag for undefined data. |
static int |
TYPE_USHORT
Tag for unsigned short data. |
| Constructor Summary | |
|---|---|
protected |
DataBuffer
Constructs a DataBuffer containing one bank of the specified data type and size. |
protected |
DataBuffer
Constructs a DataBuffer containing the specified number of banks. |
protected |
DataBuffer
Constructs a DataBuffer that contains the specified number of banks. |
protected |
DataBuffer
Constructs a DataBuffer which contains the specified number of banks. |
| Method Summary | |
|---|---|
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. |
Methods inherited from class java.lang.Object ![]() |
|---|
clone |
| Field Detail |
|---|

public static final int TYPE_BYTE

public static final int TYPE_USHORT

public static final int TYPE_SHORT

public static final int TYPE_INT

public static final int TYPE_FLOAT

public static final int TYPE_DOUBLE

public static final int TYPE_UNDEFINED

protected int dataType

protected int banks

protected int offset

protected int size

protected int[] offsets
| Constructor Detail |
|---|

protected DataBuffer(int dataType,
int size)
dataType - the data type of this DataBuffersize - the size of the banks

protected DataBuffer(int dataType,
int size,
int numBanks)
dataType - the data type of this DataBuffersize - 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 DataBuffersize - the size of the banksnumBanks - the number of banks in this
DataBufferoffset - the offset for each bank

protected DataBuffer(int dataType,
int size,
int numBanks,
int[] offsets)
dataType - the data type of this DataBuffersize - the size of the banksnumBanks - the number of banks in this
DataBufferoffsets - an array containing an offset for each bank.
ArrayIndexOutOfBoundsException

- if numBanks
does not equal the length of offsets| Method Detail |
|---|

public static int getDataTypeSize(int type)
type - the value of one of the defined datatype tags
IllegalArgumentException

- 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 element
setElem(int, int)
,
setElem(int, int, int)


public abstract int getElem(int bank,
int i)
bank - the specified banki - the index of the requested data array element
setElem(int, int)
,
setElem(int, int, int)


public 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 arraygetElem(int)
,
getElem(int, int)


public 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 arraygetElem(int)
,
getElem(int, int)


public float getElemFloat(int i)
i - the index of the requested data array element
setElemFloat(int, float)
,
setElemFloat(int, int, float)


public 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 element
setElemFloat(int, float)
,
setElemFloat(int, int, float)


public 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 arraygetElemFloat(int)
,
getElemFloat(int, int)


public 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 arraygetElemFloat(int)
,
getElemFloat(int, int)


public double getElemDouble(int i)
getElem(int)
to a double. Subclasses can override this method if another
implementation is needed.
i - the specified index
setElemDouble(int, double)
,
setElemDouble(int, int, double)


public double getElemDouble(int bank,
int i)
bank - the specified banki - the specified index
setElemDouble(int, double)
,
setElemDouble(int, int, double)


public 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 arraygetElemDouble(int)
,
getElemDouble(int, int)


public 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 arraygetElemDouble(int)
,
getElemDouble(int, int)

|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||