All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class java.awt.image.DataBuffer

java.lang.Object
    |
    +----java.awt.image.DataBuffer

public abstract class DataBuffer
extends Object
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 without bank specifiers 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. The size + offset fields for a given bank should never be longer than the array length of the associatied data array. Generally, an object of class DataBuffer will be cast down to one of it's subclasses for improved speed.


Variable Index

 o banks
The number of banks (or arrays in this DataBuffer).
 o BYTE_DATA
Tag for byte data.
 o dataType
The datatype of this DataBuffer.
 o DOUBLE_DATA
Tag for byte data.
 o FLOAT_DATA
Tag for byte data.
 o INT_DATA
Tag for int data.
 o LONG_DATA
Tag for long data.
 o offset
Offset into default (first) bank from which to get the first element.
 o offsets
Offsets into all banks.
 o SHORT_DATA
Tag for short data.
 o size
Usable size of the a bank.

Constructor Index

 o DataBuffer(int, int)
Constructs a DataBuffer containing one bank of the specified data type and size.
 o DataBuffer(int, int, int)
Constructs a DataBuffer containing the specified number of banks.
 o DataBuffer(int, int, int, int)
Constructs a DataBuffer which contains the specified number of banks.
 o DataBuffer(int, int, int, int[])
Constructs a DataBuffer which contains the specified number of banks.

Method Index

 o getDataType()
This returns the data type of this DataBuffer.
 o getElem(int)
Returns the requested data array element from the first (default) bank as an integer.
 o getElem(int, int)
Returns the requested data array element from the specified bank as an integer.
 o getElemDouble(int)
Returns the requested data array element from the first (default) bank as a double.
 o getElemDouble(int, int)
Returns the requested data array element from the specified bank as a double.
 o getElemFloat(int)
Returns the requested data array element from the first (default) bank as a float.
 o getElemFloat(int, int)
Returns the requested data array element from the specified bank as a float.
 o getNumBanks()
Returns the number of banks in this DataBuffer.
 o getOffset()
Returns the offset of the default bank in array elements.
 o getOffsets()
Returns the offsets of all the banks in array elements.
 o getSize()
Returns the size of the default bank in array elements.
 o setElem(int, int)
Sets the requested data array element in the first (default) bank from the given integer.
 o setElem(int, int, int)
Sets the requested data array element in the specified bank from the given integer.
 o setElemDouble(int, double)
Sets the requested data array element in the first (default) bank from the given double.
 o setElemDouble(int, int, double)
Sets the requested data array element in the specified bank from the given double.
 o setElemFloat(int, float)
Sets the requested data array element in the first (default) bank from the given float.
 o setElemFloat(int, int, float)
Sets the requested data array element in the specified bank from the given float.
 o sizeOf(int)
Size of the data type, given a datatype tag.
 o toIntArray(Object)
Converts an input array of some primitive datatype (byte/short/int) into an integer array.

Variables

 o BYTE_DATA
public static final int BYTE_DATA
Tag for byte data.

 o SHORT_DATA
public static final int SHORT_DATA
Tag for short data.

 o INT_DATA
public static final int INT_DATA
Tag for int data.

 o LONG_DATA
public static final int LONG_DATA
Tag for long data.

 o FLOAT_DATA
public static final int FLOAT_DATA
Tag for byte data.

 o DOUBLE_DATA
public static final int DOUBLE_DATA
Tag for byte data.

 o dataType
protected int dataType
The datatype of this DataBuffer.

 o banks
protected int banks
The number of banks (or arrays in this DataBuffer).

 o offset
protected int offset
Offset into default (first) bank from which to get the first element.

 o size
protected int size
Usable size of the a bank.

 o offsets
protected int[] offsets
Offsets into all banks.

Constructors

 o DataBuffer
protected DataBuffer(int dataType,
                     int size)
Constructs a DataBuffer containing one bank of the specified data type and size.

 o DataBuffer
protected DataBuffer(int dataType,
                     int size,
                     int numBanks)
Constructs a DataBuffer containing the specified number of banks. Each bank has the specified size and an offset of 0.

 o DataBuffer
protected DataBuffer(int dataType,
                     int size,
                     int numBanks,
                     int offset)
Constructs a DataBuffer which contains the specified number of banks. Each bank has the specified datatype, size and offset.

 o DataBuffer
protected DataBuffer(int dataType,
                     int size,
                     int numBanks,
                     int[] offsets)
Constructs a DataBuffer which contains the specified number of banks. Each bank has the specified datatype and size. The offset for each bank corresponds to it's respective entry in the offsets array.

Methods

 o sizeOf
public static int sizeOf(int type)
Size of the data type, given a datatype tag.

 o toIntArray
public static int[] toIntArray(Object obj)
Converts an input array of some primitive datatype (byte/short/int) into an integer array. If the input array is of type int[], it will be returned as is. Otherwise, an integer array will be created and elements promoted to ints and copied. Masks will be used to prevent sign extension on byte values. Returns null if obj is not of type byte[], short[] or int[].

 o getDataType
public int getDataType()
This returns the data type of this DataBuffer.

 o getSize
public int getSize()
Returns the size of the default bank in array elements.

 o getOffset
public int getOffset()
Returns the offset of the default bank in array elements.

 o getOffsets
public int[] getOffsets()
Returns the offsets of all the banks in array elements.

 o getNumBanks
public int getNumBanks()
Returns the number of banks in this DataBuffer.

 o getElem
public int getElem(int i)
Returns the requested data array element from the first (default) bank as an integer.

 o getElem
public abstract int getElem(int bank,
                            int i)
Returns the requested data array element from the specified bank as an integer.

 o setElem
public void setElem(int i,
                    int val)
Sets the requested data array element in the first (default) bank from the given integer.

 o setElem
public abstract void setElem(int bank,
                             int i,
                             int val)
Sets the requested data array element in the specified bank from the given integer.

 o getElemFloat
public float getElemFloat(int i)
Returns the requested data array element from the first (default) bank as a float.

 o getElemFloat
public float getElemFloat(int bank,
                          int i)
Returns the requested data array element from the specified bank as a float.

 o setElemFloat
public void setElemFloat(int i,
                         float val)
Sets the requested data array element in the first (default) bank from the given float.

 o setElemFloat
public void setElemFloat(int bank,
                         int i,
                         float val)
Sets the requested data array element in the specified bank from the given float.

 o getElemDouble
public double getElemDouble(int i)
Returns the requested data array element from the first (default) bank as a double.

 o getElemDouble
public double getElemDouble(int bank,
                            int i)
Returns the requested data array element from the specified bank as a double.

 o setElemDouble
public void setElemDouble(int i,
                          double val)
Sets the requested data array element in the first (default) bank from the given double.

 o setElemDouble
public void setElemDouble(int bank,
                          int i,
                          double val)
Sets the requested data array element in the specified bank from the given double.


All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Submit a bug or feature