|
Oracle interMedia Java Classes API Reference 10g Release 2 (10.2) Part No. B14301-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
oracle.ord.media.jai.io.SeekableOutputStream
oracle.ord.media.jai.io.BlobOutputStream
The BlobOutputStream class writes data to database Blobs. It is a subclass of oracle.ord.media.jai.io.SeekableOutputStream.
This class uses buffering while writing to an underlying Blob. The simple constructor (the one that takes only a Blob or BLOB ) uses a default buffer size unless an optimal size can be determined by the database. Users can also specify any buffer size using an alternate constructor.
In order to to use the JAI stream objects, you will need to include the following import statements in your Java file:
import java.sql.Blob; import oracle.sql.BFILE;
In order to use JAI with interMedia JAI stream objects, you will also need to import classes from the oracle.ord.media.jai.io package into your Java file.
Before running the methods associated with the BlobOutputStream object, the following operations must have already been performed:
import javax.media.jai.JAI; import java.awt.image.RenderedImage;
Constructor Summary | |
BlobOutputStream(java.sql.Blob blob)
Creates a BlobOutputStream object that writes to the specified java.sql.Blob, using a default buffer size of 32K unless an optimal chunk size can be determined by the database. |
|
BlobOutputStream(oracle.sql.BLOB blob)
Deprecated. |
|
BlobOutputStream(java.sql.Blob blob,
int chunkSize)
Creates a BlobOutputStream object that writes to the specified Blob, using the given integer as the maximum buffer size. |
Method Summary | |
void |
close()
Closes the output stream and releases any resources associated with this stream. |
void |
flush()
Flushes the output stream and forces any buffered output bytes to be written to the Blob. |
java.lang.String |
getDBErrorMessage()
Returns the database error message associated with the last error encountered. |
long |
getFilePointer()
Returns the offset from the beginning of the Blob at which the next write operation will occur. |
boolean |
hasDBErrorMessage()
Checks whether or not a database error message has been set. |
long |
length()
Returns the current length of the output stream. |
void |
seek(long pos)
Sets the file-pointer offset, measured from the beginning of this stream, at which the next write operation will occur. |
void |
truncate(long len)
Truncates the stream to the specified length. |
void |
write(byte[] b)
Writes all bytes in the specified byte array to the Blob. |
void |
write(byte[] b,
int off,
int len)
Writes the specified number of bytes from the specified byte array to the Blob. |
void |
write(int b)
Writes the specified byte to the Blob. |
Methods inherited from class oracle.ord.media.jai.io.SeekableOutputStream |
wrapOutputStream |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BlobOutputStream(java.sql.Blob blob) throws java.io.IOException, java.sql.SQLException
blob
- the Blob to which data will be written.
java.io.IOException
- if an IO exception occurs or
if the value of the blob parameter is null
.
java.sql.SQLException
- if a SQL exception occurs.public BlobOutputStream(oracle.sql.BLOB blob) throws java.io.IOException, java.sql.SQLException
blob
- the Blob to which data will be written.
java.io.IOException
- if an IO exception occurs or
if the value of the blob parameter is null
.
java.sql.SQLException
- if a SQL exception occurs.public BlobOutputStream(java.sql.Blob blob, int chunkSize) throws java.io.IOException, java.sql.SQLException
blob
- the Blob to which data will be written.chunkSize
- the maximum amount of data to buffer before
writing to the database.
java.io.IOException
- if an IO exception occurs, or
if the value of the Blob parameter is null
, or
if the value of the chunkSize parameter is less than 1.
java.sql.SQLException
- if a SQL exception occurs.Method Detail |
public long length() throws java.io.IOException
length
in class SeekableOutputStream
java.io.IOException
- if an IO error occurs.public long getFilePointer() throws java.io.IOException
getFilePointer
in class SeekableOutputStream
java.io.IOException
- if an IO error occurs.public void seek(long pos) throws java.io.IOException
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.
seek
in class SeekableOutputStream
pos
- the offset position, measured in bytes from the beginning
of the stream, at which to set the file pointer.
java.io.IOException
- if the value of the pos parameter is
less than zero or if an IO error occurs.public void truncate(long len) throws java.io.IOException
truncate
in class SeekableOutputStream
len
- the length of the stream, in bytes.
java.io.IOException
- if the value of the len parameter is
less than zero or larger than the stream
length, or if an IO error occurs.public void write(int b) throws java.io.IOException
b
- the byte to be written to the Blob. Only the low-order
byte is written; the upper 24 bits are ignored.
java.io.IOException
- if an IO error occurs. In particular,
this exception will be thrown if the stream is closed.public void write(byte[] b) throws java.io.IOException
b
- an array of bytes to be written to the Blob.
java.io.IOException
- if an IO error occurs. In
particular, this exception will be thrown if the stream is
closed or if the value of the buffer parameter is
null
.public void write(byte[] b, int off, int len) throws java.io.IOException
b
- the buffer containing the data to be written to the
Blob.off
- the starting position for the offset in the buffer.len
- the number of bytes to write to the Blob.
java.io.IOException
- if an IO error occurs. In particular,
this exception will be thrown if the stream is closed or if the
value of the buffer parameter is null
.public void flush() throws java.io.IOException
java.io.IOException
- if an IO error occurs.public void close() throws java.io.IOException
flush()
method to write any
buffered bytes to the Blob.
java.io.IOException
- if an IO error occurs.public java.lang.String getDBErrorMessage()
String
with the last database error message,
or null
if no such message existed.public boolean hasDBErrorMessage()
true
if an exception has occurred while
communicating with the database that returned a
supplementary error message; false
otherwise.
|
Oracle interMedia Java Classes API Reference 10g Release 2 (10.2) Part No. B14301-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |