APIdia Launch Partner
Top Description Fields Constructors Methods
java.awt.image

public final Class DataBufferInt

extends DataBuffer
Class Inheritance
Imports
java.util.Objects

This class extends DataBuffer and stores data internally as integers.

Note that some implementations may function more efficiently if they can maintain control over how the data for an image is stored. For example, optimizations such as caching an image in video memory require that the implementation track all modifications to that data. Other implementations may operate better if they can store the data in locations other than a Java array. To maintain optimum compatibility with various optimizations it is best to avoid constructors and methods which expose the underlying storage as a Java array as noted below in the documentation for those methods.

Field Summary

Modifier and TypeField and Description
pack-priv int[][]
bankdata

All data banks

pack-priv int[]
data

The default data bank.

Inherited from java.awt.image.DataBuffer:
banksdataTypeoffsetoffsetssizetheTrackableTYPE_BYTETYPE_DOUBLETYPE_FLOATTYPE_INTTYPE_SHORTTYPE_UNDEFINEDTYPE_USHORT

Constructor Summary

AccessConstructor and Description
public
DataBufferInt(int
The size of the DataBuffer.
size
)

Constructs an integer-based DataBuffer with a single bank and the specified size.

public
DataBufferInt(int
The size of the banks in the DataBuffer.
size
,
int
The number of banks in the DataBuffer.
numBanks
)

Constructs an integer-based DataBuffer with the specified number of banks, all of which are the specified size.

public
DataBufferInt(int[]
The integer array for the DataBuffer.
dataArray
,
int
The size of the DataBuffer bank.
size
)

Constructs an integer-based DataBuffer with a single bank using the specified array.

public
DataBufferInt(int[]
The integer array for the DataBuffer.
dataArray
,
int
The size of the DataBuffer bank.
size
,
int
The offset into the dataArray.
offset
)

Constructs an integer-based DataBuffer with a single bank using the specified array, size, and offset.

public
DataBufferInt(int[][]
The integer arrays for the DataBuffer.
dataArray
,
int
The size of the banks in the DataBuffer.
size
)

Constructs an integer-based DataBuffer with the specified arrays.

public
DataBufferInt(int[][]
The integer arrays for the DataBuffer.
dataArray
,
int
The size of the banks in the DataBuffer.
size
,
int[]
The offsets into each array.
offsets
)

Constructs an integer-based DataBuffer with the specified arrays, size, and offsets.

Method Summary

Modifier and TypeMethod and Description
public int[][]

Returns:

All of the data arrays.
getBankData
()

Returns the data arrays for all banks.

public int[]

Returns:

The first integer data array.
getData
()

Returns the default (first) int data array in DataBuffer.

public int[]

Returns:

The data array for the specified bank.
getData
(int
The bank whose data array you want to get.
bank
)

Returns the data array for the specified bank.

public int

Returns:

The requested data array element as an integer.
getElem
(int
The data array element you want to get.
i
)

Overrides java.awt.image.DataBuffer.getElem.

Returns the requested data array element from the first (default) bank.

public int

Returns:

The requested data array element as an integer.
getElem
(int
The bank from which you want to get a data array element.
bank
,
int
The data array element you want to get.
i
)

Implements abstract java.awt.image.DataBuffer.getElem.

Returns the requested data array element from the specified bank.

public void
setElem(int
The data array element you want to set.
i
,
int
The integer value to which you want to set the data array element.
val
)

Overrides java.awt.image.DataBuffer.setElem.

Sets the requested data array element in the first (default) bank to the specified value.

public void
setElem(int
The bank in which you want to set the data array element.
bank
,
int
The data array element you want to set.
i
,
int
The integer value to which you want to set the specified data array element.
val
)

Implements abstract java.awt.image.DataBuffer.setElem.

Sets the requested data array element in the specified bank to the integer value i.

Inherited from java.awt.image.DataBuffer:
checkArraySizecheckArraySizecheckBankcheckBankSizecheckIndexcheckIndexcheckNumBankscheckOffsetcheckSizegetDataTypegetDataTypeSizegetElemDoublegetElemDoublegetElemFloatgetElemFloatgetNumBanksgetOffsetgetOffsetsgetSizesetElemDoublesetElemDoublesetElemFloatsetElemFloattoIntArray

Field Detail

bankdataback to summary
pack-priv int[][] bankdata

All data banks

databack to summary
pack-priv int[] data

The default data bank.

Constructor Detail

DataBufferIntback to summary
public DataBufferInt(int size)

Constructs an integer-based DataBuffer with a single bank and the specified size.

Parameters
size:int

The size of the DataBuffer.

Exceptions
IllegalArgumentException:
if size is less than or equal to zero.
DataBufferIntback to summary
public DataBufferInt(int size, int numBanks)

Constructs an integer-based DataBuffer with the specified number of banks, all of which are the specified size.

Parameters
size:int

The size of the banks in the DataBuffer.

numBanks:int

The number of banks in the DataBuffer.

Exceptions
IllegalArgumentException:
if size or numBanks is less than or equal to zero.
DataBufferIntback to summary
public DataBufferInt(int[] dataArray, int size)

Constructs an integer-based DataBuffer with a single bank using the specified array. Only the first size elements should be used by accessors of this DataBuffer. dataArray must be large enough to hold size elements.

Note that DataBuffer objects created by this constructor may be incompatible with performance optimizations used by some implementations (such as caching an associated image in video memory).

Parameters
dataArray:int[]

The integer array for the DataBuffer.

size:int

The size of the DataBuffer bank.

Exceptions
NullPointerException:
if dataArray is null.
IllegalArgumentException:
if size is less than or equal to zero, or is greater than the length of dataArray.
DataBufferIntback to summary
public DataBufferInt(int[] dataArray, int size, int offset)

Constructs an integer-based DataBuffer with a single bank using the specified array, size, and offset. dataArray must have at least offset + size elements. Only elements offset through offset + size - 1 should be used by accessors of this DataBuffer.

Note that DataBuffer objects created by this constructor may be incompatible with performance optimizations used by some implementations (such as caching an associated image in video memory).

Parameters
dataArray:int[]

The integer array for the DataBuffer.

size:int

The size of the DataBuffer bank.

offset:int

The offset into the dataArray.

Exceptions
NullPointerException:
if dataArray is null.
IllegalArgumentException:
if size is less than or equal to zero, or offset is less than zero, or (offset + size) is greater than the length of dataArray.
DataBufferIntback to summary
public DataBufferInt(int[][] dataArray, int size)

Constructs an integer-based DataBuffer with the specified arrays. The number of banks will be equal to dataArray.length. Only the first size elements of each array should be used by accessors of this DataBuffer.

Note that DataBuffer objects created by this constructor may be incompatible with performance optimizations used by some implementations (such as caching an associated image in video memory).

Parameters
dataArray:int[][]

The integer arrays for the DataBuffer.

size:int

The size of the banks in the DataBuffer.

Exceptions
NullPointerException:
  • if dataArray is null.
  • if any bank of dataArray is null.
IllegalArgumentException:
  • if size is less than or equal to zero.
  • if dataArray does not have at least one bank.
  • if the length of any bank of dataArray is less than size.
DataBufferIntback to summary
public DataBufferInt(int[][] dataArray, int size, int[] offsets)

Constructs an integer-based DataBuffer with the specified arrays, size, and offsets. The number of banks is equal to dataArray.length. Each array must be at least as large as size + the corresponding offset. There must be an entry in the offset array for each dataArray entry. For each bank, only elements offset through offset + size - 1 should be used by accessors of this DataBuffer.

Note that DataBuffer objects created by this constructor may be incompatible with performance optimizations used by some implementations (such as caching an associated image in video memory).

Parameters
dataArray:int[][]

The integer arrays for the DataBuffer.

size:int

The size of the banks in the DataBuffer.

offsets:int[]

The offsets into each array.

Exceptions
IllegalArgumentException:
  • if size is less than or equal to zero.
  • if dataArray does not have at least one bank.
  • if any element of offsets is less than zero.
  • if the length of any bank of dataArray is less than (size + offsets[bankIndex]).
NullPointerException:
  • if dataArray is null.
  • if any bank of dataArray is null.
  • if offsets is null.
ArrayIndexOutOfBoundsException:
if the lengths of dataArray and offsets differ.

Method Detail

getBankDataback to summary
public int[][] getBankData()

Returns the data arrays for all banks.

Note that calling this method may cause this DataBuffer object to be incompatible with performance optimizations used by some implementations (such as caching an associated image in video memory).

Returns:int[][]

All of the data arrays.

getDataback to summary
public int[] getData()

Returns the default (first) int data array in DataBuffer.

Note that calling this method may cause this DataBuffer object to be incompatible with performance optimizations used by some implementations (such as caching an associated image in video memory).

Returns:int[]

The first integer data array.

getDataback to summary
public int[] getData(int bank)

Returns the data array for the specified bank.

Note that calling this method may cause this DataBuffer object to be incompatible with performance optimizations used by some implementations (such as caching an associated image in video memory).

Parameters
bank:int

The bank whose data array you want to get.

Returns:int[]

The data array for the specified bank.

Exceptions
ArrayIndexOutOfBoundsException:
if bank is not a valid bank index.
getElemback to summary
public int getElem(int i)

Overrides java.awt.image.DataBuffer.getElem.

Returns the requested data array element from the first (default) bank.

Parameters
i:int

The data array element you want to get.

Returns:int

The requested data array element as an integer.

Exceptions
ArrayIndexOutOfBoundsException:
if (i + getOffset()) is not a valid index.
See Also
setElem(int, int), setElem(int, int, int)
getElemback to summary
public int getElem(int bank, int i)

Implements abstract java.awt.image.DataBuffer.getElem.

Returns the requested data array element from the specified bank.

Parameters
bank:int

The bank from which you want to get a data array element.

i:int

The data array element you want to get.

Returns:int

The requested data array element as an integer.

Exceptions
ArrayIndexOutOfBoundsException:
if bank is not a valid bank index, or (i + getOffsets()[bank]) is not a valid index into the bank.
See Also
setElem(int, int), setElem(int, int, int)
setElemback to summary
public void setElem(int i, int val)

Overrides java.awt.image.DataBuffer.setElem.

Sets the requested data array element in the first (default) bank to the specified value.

Parameters
i:int

The data array element you want to set.

val:int

The integer value to which you want to set the data array element.

Exceptions
ArrayIndexOutOfBoundsException:
if (i + getOffset()) is not a valid index.
See Also
getElem(int), getElem(int, int)
setElemback to summary
public void setElem(int bank, int i, int val)

Implements abstract java.awt.image.DataBuffer.setElem.

Sets the requested data array element in the specified bank to the integer value i.

Parameters
bank:int

The bank in which you want to set the data array element.

i:int

The data array element you want to set.

val:int

The integer value to which you want to set the specified data array element.

Exceptions
ArrayIndexOutOfBoundsException:
if bank is not a valid bank index, or (i + getOffsets()[bank]) is not a valid index into the bank.
See Also
getElem(int), getElem(int, int)