FileDocCategorySizeDatePackage
IIOByteBuffer.javaAPI DocJava SE 5 API3405Fri Aug 26 14:57:32 BST 2005javax.imageio.stream

IIOByteBuffer

public class IIOByteBuffer extends Object
A class representing a mutable reference to an array of bytes and an offset and length within that array. IIOByteBuffer is used by ImageInputStream to supply a sequence of bytes to the caller, possibly with fewer copies than using the conventional read methods that take a user-supplied byte array.

The byte array referenced by an IIOByteBuffer will generally be part of an internal data structure belonging to an ImageReader implementation; its contents should be considered read-only and must not be modified.

version
0.5

Fields Summary
private byte[]
data
private int
offset
private int
length
Constructors Summary
public IIOByteBuffer(byte[] data, int offset, int length)
Constructs an IIOByteBuffer that references a given byte array, offset, and length.

param
data a byte array.
param
offset an int offset within the array.
param
length an int specifying the length of the data of interest within byte array, in bytes.

        this.data = data;
        this.offset = offset;
        this.length = length;
    
Methods Summary
public byte[]getData()
Returns a reference to the byte array. The returned value should be treated as read-only, and only the portion specified by the values of getOffset and getLength should be used.

return
a byte array reference.
see
#getOffset
see
#getLength
see
#setData

        return data;
    
public intgetLength()
Returns the length of the data of interest within the byte array returned by getData.

return
an int length.
see
#getData
see
#getOffset
see
#setLength

        return length;
    
public intgetOffset()
Returns the offset within the byte array returned by getData at which the data of interest start.

return
an int offset.
see
#getData
see
#getLength
see
#setOffset

        return offset;
    
public voidsetData(byte[] data)
Updates the array reference that will be returned by subsequent calls to the getData method.

param
data a byte array reference containing the new data value.
see
#getData

        this.data = data;
    
public voidsetLength(int length)
Updates the value that will be returned by subsequent calls to the getLength method.

param
length an int containing the new length value.
see
#getLength

        this.length = length;
    
public voidsetOffset(int offset)
Updates the value that will be returned by subsequent calls to the getOffset method.

param
offset an int containing the new offset value.
see
#getOffset

        this.offset = offset;