Oracle® interMedia Java Classes Reference 10g Release 1 (10.1) Part Number B10830-01 |
|
|
View PDF |
This section presents reference information on the methods associated with the BlobOutputStream object, which provides an interface for JAI to write data to BLOBs. It is a subclass of java.io.OutputStream.
Before running the methods associated with the BlobOutputStream object, the following operations must have already been performed:
The following import statements have been included:
import javax.media.jai.JAI; import java.awt.image.RenderedImage;
A local BlobOutputStream object named outStream has been created.
Format
public BlobOutputStream (oracle.sql.BLOB blob)
Description
Creates a BlobOutputStream object that writes to the specified BLOB, using an optimal chunk size that is determined by the database. Creating an object of this type implicitly trims the data in the BLOB to a length of zero.
Parameters
The BLOB to which data will be written.
Return Value
None.
Exceptions
java.io.IOException
java.sql.SQLException
Examples
None.
Format
public BlobOutputStream(oracle.sql.BLOB blob, int chunkSize)
Description
Creates a BlobOutputStream object that writes to the specified BLOB, using the given integer as the maximum chunk size. Creating an object of this type implicitly trims the data in the BLOB to a length of zero.
Parameters
The BLOB to which data will be written
The maximum amount of data to write to the BLOB at one time.
Return Value
None.
Exceptions
java.io.IOException
java.sql.SQLException
Examples
None.
Format
public void close( )
Description
Closes the output stream and releases any system resources associated with this stream. Before closing the stream, this method automatically calls the flush( ) method to write any buffered bytes to the BLOB.
Parameters
None.
Return Value
None.
Exceptions
java.io.IOException
Examples
None.
Format
public void flush( )
Description
Flushes the output stream and forces any buffered output bytes to be written to the BLOB.
Parameters
None.
Return Value
None.
Exceptions
java.io.IOException
Examples
None.
Format
public long getFilePointer( )
Description
Returns the offset from the beginning of the BLOB at which the next write operation will occur.
Parameters
None.
Return Value
This method returns the offset from the beginning of the BLOB at which the next write operation will occur, in bytes.
Exceptions
java.io.IOException
Examples
None.
Format
public long length( )
Description
Returns the current length of the output stream.
Parameters
None.
Return Value
This method returns the current length of the output stream.
Exceptions
java.io.IOException
Examples
None.
Format
public void seek(long pos)
Description
Sets the file-pointer offset, measured from the beginning of this stream, at which the next write operation occurs.
The offset may be set beyond the end of the stream. Setting the offset beyond the end of the stream does not change the stream length; the stream length will change only by writing after the offset has been set beyond the end of the stream.
Parameters
The offset position, measured in bytes from the beginning of the stream, at which to set the file pointer.
Return Value
None.
Exceptions
java.io.IOException
Examples
None.
Format
public void write(byte[ ] buffer)
Description
Writes all bytes in the specified byte array to the BLOB.
Parameters
An array of bytes to be written to the BLOB.
Return Value
None.
Exceptions
java.io.IOException
Examples
None.
Format
public void write(byte[ ] buffer, int off, int len)
Description
Writes the specified number of bytes from the specified byte array to the BLOB.
Parameters
The buffer containing the data to be written to the BLOB.
The starting position for the offset in the buffer.
The number of bytes to write to the BLOB.
Return Value
None.
Exceptions
java.io.IOException
Examples
None.
Format
public void write(int b)
Description
Writes the specified byte to the BLOB.
Parameters
The byte to be written to the BLOB. Only the low-order byte is written; the upper 24 bits are ignored.
Return Value
None.
Exceptions
java.io.IOException
Examples
None.