Uses of Class java.awt.image.DataBuffer (Java Platform SE 8 )
Date: 2026-04-17

## Uses of Class
java.awt.image.DataBuffer

- Packages that use DataBuffer
  Package | Description
  --- | ---
  java.awt.image | Provides classes for creating and modifying images.

- - ### Uses of DataBuffer in java.awt.image

    Subclasses of DataBuffer in java.awt.image
    Modifier and Type | Class and Description
    --- | ---
    `class` | `DataBufferByte` This class extends `DataBuffer` and stores data internally as bytes.
    `class` | `DataBufferDouble` This class extends `DataBuffer` and stores data internally in `double` form.
    `class` | `DataBufferFloat` This class extends `DataBuffer` and stores data internally in `float` form.
    `class` | `DataBufferInt` This class extends `DataBuffer` and stores data internally as integers.
    `class` | `DataBufferShort` This class extends `DataBuffer` and stores data internally as shorts.
    `class` | `DataBufferUShort` This class extends `DataBuffer` and stores data internally as shorts.

    Fields in java.awt.image declared as DataBuffer
    Modifier and Type | Field and Description
    --- | ---
    `protected DataBuffer` | Raster.`dataBuffer` The DataBuffer that stores the image data.

    Methods in java.awt.image that return DataBuffer
    Modifier and Type | Method and Description
    --- | ---
    `DataBuffer` | MultiPixelPackedSampleModel.`createDataBuffer()` Creates a `DataBuffer` that corresponds to this `MultiPixelPackedSampleModel`.
    `DataBuffer` | SinglePixelPackedSampleModel.`createDataBuffer()` Creates a DataBuffer that corresponds to this SinglePixelPackedSampleModel.
    `abstract DataBuffer` | SampleModel.`createDataBuffer()` Creates a DataBuffer that corresponds to this SampleModel.
    `DataBuffer` | BandedSampleModel.`createDataBuffer()` Creates a DataBuffer that corresponds to this BandedSampleModel, The DataBuffer's data type, number of banks, and size will be consistent with this BandedSampleModel.
    `DataBuffer` | ComponentSampleModel.`createDataBuffer()` Creates a `DataBuffer` that corresponds to this `ComponentSampleModel`.
    `DataBuffer` | Raster.`getDataBuffer()` Returns the DataBuffer associated with this Raster.

    Methods in java.awt.image with parameters of type DataBuffer
    Modifier and Type | Method and Description
    --- | ---
    `static WritableRaster` | Raster.`createBandedRaster(DataBuffer dataBuffer, int w, int h, int scanlineStride, int[] bankIndices, int[] bandOffsets, Point location)` Creates a Raster based on a BandedSampleModel with the specified DataBuffer, width, height, scanline stride, bank indices, and band offsets.
    `static WritableRaster` | Raster.`createInterleavedRaster(DataBuffer dataBuffer, int w, int h, int scanlineStride, int pixelStride, int[] bandOffsets, Point location)` Creates a Raster based on a PixelInterleavedSampleModel with the specified DataBuffer, width, height, scanline stride, pixel stride, and band offsets.
    `static WritableRaster` | Raster.`createPackedRaster(DataBuffer dataBuffer, int w, int h, int scanlineStride, int[] bandMasks, Point location)` Creates a Raster based on a SinglePixelPackedSampleModel with the specified DataBuffer, width, height, scanline stride, and band masks.
    `static WritableRaster` | Raster.`createPackedRaster(DataBuffer dataBuffer, int w, int h, int bitsPerPixel, Point location)` Creates a Raster based on a MultiPixelPackedSampleModel with the specified DataBuffer, width, height, and bits per pixel.
    `static Raster` | Raster.`createRaster(SampleModel sm, DataBuffer db, Point location)` Creates a Raster with the specified SampleModel and DataBuffer.
    `static WritableRaster` | Raster.`createWritableRaster(SampleModel sm, DataBuffer db, Point location)` Creates a WritableRaster with the specified SampleModel and DataBuffer.
    `Object` | SampleModel.`getDataElements(int x, int y, int w, int h, Object obj, DataBuffer data)` Returns the pixel data for the specified rectangle of pixels in a primitive array of type TransferType.
    `Object` | MultiPixelPackedSampleModel.`getDataElements(int x, int y, Object obj, DataBuffer data)` Returns data for a single pixel in a primitive array of type TransferType.
    `Object` | SinglePixelPackedSampleModel.`getDataElements(int x, int y, Object obj, DataBuffer data)` Returns data for a single pixel in a primitive array of type TransferType.
    `abstract Object` | SampleModel.`getDataElements(int x, int y, Object obj, DataBuffer data)` Returns data for a single pixel in a primitive array of type TransferType.
    `Object` | BandedSampleModel.`getDataElements(int x, int y, Object obj, DataBuffer data)` Returns data for a single pixel in a primitive array of type TransferType.
    `Object` | ComponentSampleModel.`getDataElements(int x, int y, Object obj, DataBuffer data)` Returns data for a single pixel in a primitive array of type `TransferType`.
    `double[]` | SampleModel.`getPixel(int x, int y, double[] dArray, DataBuffer data)` Returns the samples for the specified pixel in an array of double.
    `float[]` | SampleModel.`getPixel(int x, int y, float[] fArray, DataBuffer data)` Returns the samples for the specified pixel in an array of float.
    `int[]` | MultiPixelPackedSampleModel.`getPixel(int x, int y, int[] iArray, DataBuffer data)` Returns the specified single band pixel in the first element of an `int` array.
    `int[]` | SinglePixelPackedSampleModel.`getPixel(int x, int y, int[] iArray, DataBuffer data)` Returns all samples in for the specified pixel in an int array.
    `int[]` | SampleModel.`getPixel(int x, int y, int[] iArray, DataBuffer data)` Returns the samples for a specified pixel in an int array, one sample per array element.
    `int[]` | BandedSampleModel.`getPixel(int x, int y, int[] iArray, DataBuffer data)` Returns all samples for the specified pixel in an int array.
    `int[]` | ComponentSampleModel.`getPixel(int x, int y, int[] iArray, DataBuffer data)` Returns all samples for the specified pixel in an int array, one sample per array element.
    `double[]` | SampleModel.`getPixels(int x, int y, int w, int h, double[] dArray, DataBuffer data)` Returns all samples for a rectangle of pixels in a double array, one sample per array element.
    `float[]` | SampleModel.`getPixels(int x, int y, int w, int h, float[] fArray, DataBuffer data)` Returns all samples for a rectangle of pixels in a float array, one sample per array element.
    `int[]` | SinglePixelPackedSampleModel.`getPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data)` Returns all samples for the specified rectangle of pixels in an int array, one sample per array element.
    `int[]` | SampleModel.`getPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data)` Returns all samples for a rectangle of pixels in an int array, one sample per array element.
    `int[]` | BandedSampleModel.`getPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data)` Returns all samples for the specified rectangle of pixels in an int array, one sample per data array element.
    `int[]` | ComponentSampleModel.`getPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data)` Returns all samples for the specified rectangle of pixels in an int array, one sample per array element.
    `int` | MultiPixelPackedSampleModel.`getSample(int x, int y, int b, DataBuffer data)` Returns as `int` the sample in a specified band for the pixel located at (x, y).
    `int` | SinglePixelPackedSampleModel.`getSample(int x, int y, int b, DataBuffer data)` Returns as int the sample in a specified band for the pixel located at (x,y).
    `abstract int` | SampleModel.`getSample(int x, int y, int b, DataBuffer data)` Returns the sample in a specified band for the pixel located at (x,y) as an int.
    `int` | BandedSampleModel.`getSample(int x, int y, int b, DataBuffer data)` Returns as int the sample in a specified band for the pixel located at (x,y).
    `int` | ComponentSampleModel.`getSample(int x, int y, int b, DataBuffer data)` Returns as int the sample in a specified band for the pixel located at (x,y).
    `double` | SampleModel.`getSampleDouble(int x, int y, int b, DataBuffer data)` Returns the sample in a specified band for a pixel located at (x,y) as a double.
    `double` | BandedSampleModel.`getSampleDouble(int x, int y, int b, DataBuffer data)` Returns the sample in a specified band for a pixel located at (x,y) as a double.
    `double` | ComponentSampleModel.`getSampleDouble(int x, int y, int b, DataBuffer data)` Returns the sample in a specified band for a pixel located at (x,y) as a double.
    `float` | SampleModel.`getSampleFloat(int x, int y, int b, DataBuffer data)` Returns the sample in a specified band for the pixel located at (x,y) as a float.
    `float` | BandedSampleModel.`getSampleFloat(int x, int y, int b, DataBuffer data)` Returns the sample in a specified band for the pixel located at (x,y) as a float.
    `float` | ComponentSampleModel.`getSampleFloat(int x, int y, int b, DataBuffer data)` Returns the sample in a specified band for the pixel located at (x,y) as a float.
    `double[]` | SampleModel.`getSamples(int x, int y, int w, int h, int b, double[] dArray, DataBuffer data)` Returns the samples for a specified band for a specified rectangle of pixels in a double array, one sample per array element.
    `float[]` | SampleModel.`getSamples(int x, int y, int w, int h, int b, float[] fArray, DataBuffer data)` Returns the samples for a specified band for the specified rectangle of pixels in a float array, one sample per array element.
    `int[]` | SinglePixelPackedSampleModel.`getSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data)` Returns the samples for a specified band for the specified rectangle of pixels in an int array, one sample per array element.
    `int[]` | SampleModel.`getSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data)` Returns the samples for a specified band for the specified rectangle of pixels in an int array, one sample per array element.
    `int[]` | BandedSampleModel.`getSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data)` Returns the samples in a specified band for the specified rectangle of pixels in an int array, one sample per data array element.
    `int[]` | ComponentSampleModel.`getSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data)` Returns the samples in a specified band for the specified rectangle of pixels in an int array, one sample per data array element.
    `void` | SampleModel.`setDataElements(int x, int y, int w, int h, Object obj, DataBuffer data)` Sets the data for a rectangle of pixels in the specified DataBuffer from a primitive array of type TransferType.
    `void` | MultiPixelPackedSampleModel.`setDataElements(int x, int y, Object obj, DataBuffer data)` Sets the data for a single pixel in the specified `DataBuffer` from a primitive array of type TransferType.
    `void` | SinglePixelPackedSampleModel.`setDataElements(int x, int y, Object obj, DataBuffer data)` Sets the data for a single pixel in the specified DataBuffer from a primitive array of type TransferType.
    `abstract void` | SampleModel.`setDataElements(int x, int y, Object obj, DataBuffer data)` Sets the data for a single pixel in the specified DataBuffer from a primitive array of type TransferType.
    `void` | BandedSampleModel.`setDataElements(int x, int y, Object obj, DataBuffer data)` Sets the data for a single pixel in the specified DataBuffer from a primitive array of type TransferType.
    `void` | ComponentSampleModel.`setDataElements(int x, int y, Object obj, DataBuffer data)` Sets the data for a single pixel in the specified `DataBuffer` from a primitive array of type `TransferType`.
    `void` | SampleModel.`setPixel(int x, int y, double[] dArray, DataBuffer data)` Sets a pixel in the DataBuffer using a double array of samples for input.
    `void` | SampleModel.`setPixel(int x, int y, float[] fArray, DataBuffer data)` Sets a pixel in the DataBuffer using a float array of samples for input.
    `void` | MultiPixelPackedSampleModel.`setPixel(int x, int y, int[] iArray, DataBuffer data)` Sets a pixel in the `DataBuffer` using an `int` array for input.
    `void` | SinglePixelPackedSampleModel.`setPixel(int x, int y, int[] iArray, DataBuffer data)` Sets a pixel in the DataBuffer using an int array of samples for input.
    `void` | SampleModel.`setPixel(int x, int y, int[] iArray, DataBuffer data)` Sets a pixel in the DataBuffer using an int array of samples for input.
    `void` | BandedSampleModel.`setPixel(int x, int y, int[] iArray, DataBuffer data)` Sets a pixel in the DataBuffer using an int array of samples for input.
    `void` | ComponentSampleModel.`setPixel(int x, int y, int[] iArray, DataBuffer data)` Sets a pixel in the `DataBuffer` using an int array of samples for input.
    `void` | SampleModel.`setPixels(int x, int y, int w, int h, double[] dArray, DataBuffer data)` Sets all samples for a rectangle of pixels from a double array containing one sample per array element.
    `void` | SampleModel.`setPixels(int x, int y, int w, int h, float[] fArray, DataBuffer data)` Sets all samples for a rectangle of pixels from a float array containing one sample per array element.
    `void` | SinglePixelPackedSampleModel.`setPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data)` Sets all samples for a rectangle of pixels from an int array containing one sample per array element.
    `void` | SampleModel.`setPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data)` Sets all samples for a rectangle of pixels from an int array containing one sample per array element.
    `void` | BandedSampleModel.`setPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data)` Sets all samples for a rectangle of pixels from an int array containing one sample per array element.
    `void` | ComponentSampleModel.`setPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data)` Sets all samples for a rectangle of pixels from an int array containing one sample per array element.
    `void` | SampleModel.`setSample(int x, int y, int b, double s, DataBuffer data)` Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using a double for input.
    `void` | BandedSampleModel.`setSample(int x, int y, int b, double s, DataBuffer data)` Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using a double for input.
    `void` | ComponentSampleModel.`setSample(int x, int y, int b, double s, DataBuffer data)` Sets a sample in the specified band for the pixel located at (x,y) in the `DataBuffer` using a double for input.
    `void` | SampleModel.`setSample(int x, int y, int b, float s, DataBuffer data)` Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using a float for input.
    `void` | BandedSampleModel.`setSample(int x, int y, int b, float s, DataBuffer data)` Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using a float for input.
    `void` | ComponentSampleModel.`setSample(int x, int y, int b, float s, DataBuffer data)` Sets a sample in the specified band for the pixel located at (x,y) in the `DataBuffer` using a float for input.
    `void` | MultiPixelPackedSampleModel.`setSample(int x, int y, int b, int s, DataBuffer data)` Sets a sample in the specified band for the pixel located at (x, y) in the `DataBuffer` using an `int` for input.
    `void` | SinglePixelPackedSampleModel.`setSample(int x, int y, int b, int s, DataBuffer data)` Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using an int for input.
    `abstract void` | SampleModel.`setSample(int x, int y, int b, int s, DataBuffer data)` Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using an int for input.
    `void` | BandedSampleModel.`setSample(int x, int y, int b, int s, DataBuffer data)` Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using an int for input.
    `void` | ComponentSampleModel.`setSample(int x, int y, int b, int s, DataBuffer data)` Sets a sample in the specified band for the pixel located at (x,y) in the `DataBuffer` using an int for input.
    `void` | SampleModel.`setSamples(int x, int y, int w, int h, int b, double[] dArray, DataBuffer data)` Sets the samples in the specified band for the specified rectangle of pixels from a double array containing one sample per array element.
    `void` | SampleModel.`setSamples(int x, int y, int w, int h, int b, float[] fArray, DataBuffer data)` Sets the samples in the specified band for the specified rectangle of pixels from a float array containing one sample per array element.
    `void` | SinglePixelPackedSampleModel.`setSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data)` Sets the samples in the specified band for the specified rectangle of pixels from an int array containing one sample per array element.
    `void` | SampleModel.`setSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data)` Sets the samples in the specified band for the specified rectangle of pixels from an int array containing one sample per array element.
    `void` | BandedSampleModel.`setSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data)` Sets the samples in the specified band for the specified rectangle of pixels from an int array containing one sample per data array element.
    `void` | ComponentSampleModel.`setSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data)` Sets the samples in the specified band for the specified rectangle of pixels from an int array containing one sample per data array element.

    Constructors in java.awt.image with parameters of type DataBuffer
    Constructor and Description
    `Raster(SampleModel sampleModel, DataBuffer dataBuffer, Point origin)` Constructs a Raster with the given SampleModel and DataBuffer.
    `Raster(SampleModel sampleModel, DataBuffer dataBuffer, Rectangle aRegion, Point sampleModelTranslate, Raster parent)` Constructs a Raster with the given SampleModel, DataBuffer, and parent.
    `WritableRaster(SampleModel sampleModel, DataBuffer dataBuffer, Point origin)` Constructs a WritableRaster with the given SampleModel and DataBuffer.
    `WritableRaster(SampleModel sampleModel, DataBuffer dataBuffer, Rectangle aRegion, Point sampleModelTranslate, WritableRaster parent)` Constructs a WritableRaster with the given SampleModel, DataBuffer, and parent.

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.