javax.imageio.stream
Class IIOByteBuffer

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.imageio.stream.IIOByteBuffer

public class IIOByteBuffer
extends Object sample code for java.lang.Object definition code for java.lang.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.


Constructor Summary
IIOByteBuffer sample code for javax.imageio.stream.IIOByteBuffer.IIOByteBuffer(byte[], int, int) definition code for javax.imageio.stream.IIOByteBuffer.IIOByteBuffer(byte[], int, int) (byte[] data, int offset, int length)
          Constructs an IIOByteBuffer that references a given byte array, offset, and length.
 
Method Summary
 byte[] getData sample code for javax.imageio.stream.IIOByteBuffer.getData() definition code for javax.imageio.stream.IIOByteBuffer.getData() ()
          Returns a reference to the byte array.
 int getLength sample code for javax.imageio.stream.IIOByteBuffer.getLength() definition code for javax.imageio.stream.IIOByteBuffer.getLength() ()
          Returns the length of the data of interest within the byte array returned by getData.
 int getOffset sample code for javax.imageio.stream.IIOByteBuffer.getOffset() definition code for javax.imageio.stream.IIOByteBuffer.getOffset() ()
          Returns the offset within the byte array returned by getData at which the data of interest start.
 void setData sample code for javax.imageio.stream.IIOByteBuffer.setData(byte[]) definition code for javax.imageio.stream.IIOByteBuffer.setData(byte[]) (byte[] data)
          Updates the array reference that will be returned by subsequent calls to the getData method.
 void setLength sample code for javax.imageio.stream.IIOByteBuffer.setLength(int) definition code for javax.imageio.stream.IIOByteBuffer.setLength(int) (int length)
          Updates the value that will be returned by subsequent calls to the getLength method.
 void setOffset sample code for javax.imageio.stream.IIOByteBuffer.setOffset(int) definition code for javax.imageio.stream.IIOByteBuffer.setOffset(int) (int offset)
          Updates the value that will be returned by subsequent calls to the getOffset method.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

IIOByteBuffer sample code for javax.imageio.stream.IIOByteBuffer(byte[], int, int) definition code for javax.imageio.stream.IIOByteBuffer(byte[], int, int)

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

Parameters:
data - a byte array.
offset - an int offset within the array.
length - an int specifying the length of the data of interest within byte array, in bytes.
Method Detail

getData sample code for javax.imageio.stream.IIOByteBuffer.getData() definition code for javax.imageio.stream.IIOByteBuffer.getData()

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.

Returns:
a byte array reference.
See Also:
getOffset() sample code for javax.imageio.stream.IIOByteBuffer.getOffset() definition code for javax.imageio.stream.IIOByteBuffer.getOffset() , getLength() sample code for javax.imageio.stream.IIOByteBuffer.getLength() definition code for javax.imageio.stream.IIOByteBuffer.getLength() , setData(byte[]) sample code for javax.imageio.stream.IIOByteBuffer.setData(byte[]) definition code for javax.imageio.stream.IIOByteBuffer.setData(byte[])

setData sample code for javax.imageio.stream.IIOByteBuffer.setData(byte[]) definition code for javax.imageio.stream.IIOByteBuffer.setData(byte[])

public void setData(byte[] data)
Updates the array reference that will be returned by subsequent calls to the getData method.

Parameters:
data - a byte array reference containing the new data value.
See Also:
getData() sample code for javax.imageio.stream.IIOByteBuffer.getData() definition code for javax.imageio.stream.IIOByteBuffer.getData()

getOffset sample code for javax.imageio.stream.IIOByteBuffer.getOffset() definition code for javax.imageio.stream.IIOByteBuffer.getOffset()

public int getOffset()
Returns the offset within the byte array returned by getData at which the data of interest start.

Returns:
an int offset.
See Also:
getData() sample code for javax.imageio.stream.IIOByteBuffer.getData() definition code for javax.imageio.stream.IIOByteBuffer.getData() , getLength() sample code for javax.imageio.stream.IIOByteBuffer.getLength() definition code for javax.imageio.stream.IIOByteBuffer.getLength() , setOffset(int) sample code for javax.imageio.stream.IIOByteBuffer.setOffset(int) definition code for javax.imageio.stream.IIOByteBuffer.setOffset(int)

setOffset sample code for javax.imageio.stream.IIOByteBuffer.setOffset(int) definition code for javax.imageio.stream.IIOByteBuffer.setOffset(int)

public void setOffset(int offset)
Updates the value that will be returned by subsequent calls to the getOffset method.

Parameters:
offset - an int containing the new offset value.
See Also:
getOffset() sample code for javax.imageio.stream.IIOByteBuffer.getOffset() definition code for javax.imageio.stream.IIOByteBuffer.getOffset()

getLength sample code for javax.imageio.stream.IIOByteBuffer.getLength() definition code for javax.imageio.stream.IIOByteBuffer.getLength()

public int getLength()
Returns the length of the data of interest within the byte array returned by getData.

Returns:
an int length.
See Also:
getData() sample code for javax.imageio.stream.IIOByteBuffer.getData() definition code for javax.imageio.stream.IIOByteBuffer.getData() , getOffset() sample code for javax.imageio.stream.IIOByteBuffer.getOffset() definition code for javax.imageio.stream.IIOByteBuffer.getOffset() , setLength(int) sample code for javax.imageio.stream.IIOByteBuffer.setLength(int) definition code for javax.imageio.stream.IIOByteBuffer.setLength(int)

setLength sample code for javax.imageio.stream.IIOByteBuffer.setLength(int) definition code for javax.imageio.stream.IIOByteBuffer.setLength(int)

public void setLength(int length)
Updates the value that will be returned by subsequent calls to the getLength method.

Parameters:
length - an int containing the new length value.
See Also:
getLength() sample code for javax.imageio.stream.IIOByteBuffer.getLength() definition code for javax.imageio.stream.IIOByteBuffer.getLength()