Interface OracleBlob
-
- All Superinterfaces:
Blob
- All Known Implementing Classes:
BLOB
public interface OracleBlob extends Blob
This interface defines the Oracle extensions to the standard JDBC interfaceBlob
.Generally any new code should avoid the direct use of the class
BLOB
. For variable declarations use the interfaceBlob
or this interface as required. Instead of the static methodsBLOB.createTemporary(java.sql.Connection, boolean, int)
andBLOB.empty_lob()
please useConnection.createBlob()
andBLOB.getEmptyBLOB()
respectively.- Since:
- 11.2.0.3
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
close()
Close a previously opened BLOB.default Flow.Publisher<Void>
freeAsyncOracle()
Returns aPublisher
that publishes the result of freeing theBlob
object and the resources that it holds.InputStream
getBinaryStream(long pos)
Read from the BLOB as a stream at the requested position.int
getBytes(long pos, int length, byte[] buf)
Oracle extension.boolean
isEmptyLob()
Return true if the lob locator points to a empty blob.boolean
isOpen()
Check whether the BLOB is opened.boolean
isSecureFile()
Returnstrue
if this is a SecureFile (LOBs with the STORE AS SECUREFILE option, which were introduced in Oracle Database 11g Release 1).boolean
isTemporary()
Return true if the lob locator points to a temporary blob.void
open(LargeObjectAccessMode mode)
Open a BLOB in the indicated mode.default Flow.Publisher<byte[]>
publisherOracle(long position)
Returns aPublisher
that publishes the content of thisBlob
beginning at the specified position.default Flow.Subscriber<byte[]>
subscriberOracle(long position)
Returns aSubscriber
that will append the published bytes to thisBlob
beginning at the specified position.default Flow.Subscriber<byte[]>
subscriberOracle(long position, Flow.Subscriber<Long> outcomeSubscriber)
Returns aSubscriber
that will append the published bytes to thisBlob
beginning at the specified position.SQLXML
toSQLXML()
Returns an object which impements java.sql.SQLXML with content take from this Clob.SQLXML
toSQLXML(int csid)
Returns an object which impements java.sql.SQLXML with content taken from this Blob.-
Methods inherited from interface java.sql.Blob
free, getBinaryStream, getBinaryStream, getBytes, length, position, position, setBinaryStream, setBytes, setBytes, truncate
-
-
-
-
Method Detail
-
open
void open(LargeObjectAccessMode mode) throws SQLException
Open a BLOB in the indicated mode. Valid modes include MODE_READONLY, and MODE_READWRITE. It is an error to open the same LOB twice.- Throws:
SQLException
- Since:
- 8.2.0
-
close
void close() throws SQLException
Close a previously opened BLOB.- Throws:
SQLException
- Since:
- 8.2.0
-
isOpen
boolean isOpen() throws SQLException
Check whether the BLOB is opened.- Returns:
- true if the LOB is opened.
- Throws:
SQLException
- Since:
- 8.2.0
-
getBytes
int getBytes(long pos, int length, byte[] buf) throws SQLException
Oracle extension. Copy the contents of the BLOB at the requested position to the supplied buffer.- Parameters:
pos
- is the first byte of the blob to be extracted.length
- is the number of consecutive bytes to be copied.buf
- is the buffer to had the extracted bytes.- Returns:
- a byte array containing a portion of the BLOB
- Throws:
SQLException
-
isEmptyLob
boolean isEmptyLob() throws SQLException
Return true if the lob locator points to a empty blob. False if it does not.- Returns:
- true if the lob locator points to a empty blob. False if it does not.
- Throws:
SQLException
- Since:
- 8.1.7
-
isSecureFile
boolean isSecureFile() throws SQLException
Returnstrue
if this is a SecureFile (LOBs with the STORE AS SECUREFILE option, which were introduced in Oracle Database 11g Release 1).- Returns:
true
if this is a SecureFile andfalse
otherwise.- Throws:
SQLException
-
getBinaryStream
InputStream getBinaryStream(long pos) throws SQLException
Read from the BLOB as a stream at the requested position.- Parameters:
pos
- is the position data to be read.- Returns:
- a input stream to read data from the BLOB
- Throws:
SQLException
- Since:
- 8.2.0
-
isTemporary
boolean isTemporary() throws SQLException
Return true if the lob locator points to a temporary blob. False if it does not.- Returns:
- true if the lob locator points to a temporary blob. False if it does not.
- Throws:
SQLException
- Since:
- 8.2.0
-
toSQLXML
SQLXML toSQLXML() throws SQLException
Returns an object which impements java.sql.SQLXML with content take from this Clob.- Returns:
- the new SQLXML object
- Throws:
SQLException
- Since:
- 12.2
-
toSQLXML
SQLXML toSQLXML(int csid) throws SQLException
Returns an object which impements java.sql.SQLXML with content taken from this Blob.- Returns:
- the new SQLXML object
- Throws:
SQLException
- Since:
- 12.2
-
publisherOracle
default Flow.Publisher<byte[]> publisherOracle(long position) throws SQLException
Returns aPublisher
that publishes the content of thisBlob
beginning at the specified position. The argument to each call toSubscriber.onNext
will contain an implementation defined number of bytes.Calling any method of this
Blob
exceptisEmptyLob()
,isSecureFile()
,isTemporary()
, or one defined byObject
between the time this method is called and the time when the returned publisher terminates will block.The returned publisher terminates once all subscribers have received
Subscriber.onComplete
, receivedSubscriber.onError
, or cancelled their subscription.Asynchronous tasks initiated by this method will execute under the current
AccessControlContext
of the calling thread.- Parameters:
position
- the position at which to start reading from the BLOB value that thisBlob
object represents; The first position is 1- Returns:
- a
Publisher
of the content of thisBlob
- Throws:
SQLException
- if a database error occurs, or if this method is called on aBlob
that has been freed, or ifposition
is less than 1- Since:
- 20
-
subscriberOracle
default Flow.Subscriber<byte[]> subscriberOracle(long position) throws SQLException
Returns aSubscriber
that will append the published bytes to thisBlob
beginning at the specified position.Calling any method of this
Blob
exceptisEmptyLob()
,isSecureFile()
,isTemporary()
, or one defined byObject
between the time this method is called and the time when the returnedSubscriber
terminates will block.The returned
Subscriber
terminates onceSubscriber.onComplete
is received,Subscriber.onError
is received, or its subscription is cancelled.Asynchronous tasks initiated by this method will execute under the current
AccessControlContext
of the calling thread.- Parameters:
position
- the position at which to start reading from the BLOB value that thisBlob
object represents; The first position is 1- Returns:
- a
Subscriber
that appends bytes to thisBlob
- Throws:
SQLException
- if a database error occurs, or if this method is called on aBlob
that has been freed, or ifposition
is less than 1- Since:
- 20
-
subscriberOracle
default Flow.Subscriber<byte[]> subscriberOracle(long position, Flow.Subscriber<Long> outcomeSubscriber) throws SQLException
Returns aSubscriber
that will append the published bytes to thisBlob
beginning at the specified position.Calling any method of this
Blob
exceptisEmptyLob()
,isSecureFile()
,isTemporary()
, or one defined byObject
between the time this method is called and the time when the returnedSubscriber
terminates will block.The returned
Subscriber
terminates onceSubscriber.onComplete
is received,Subscriber.onError
is received, or its subscription is cancelled.The outcome of writing published bytes to the BLOB value that this Blob object represents is published to the
outcomeSubscriber
:- The
outcomeSubscriber
receives anonNext
signal each time a write to the BLOB value is successful. The number of bytes transferred in each successful write is the argument to each invocation ofonNext
. - The
outcomeSubscriber
receives anonComplete
signal after the last published byte has been written successfully. - The
outcomeSubscriber
receives anonError
signal with aSQLException
if a failure occurs when writing published bytes.
The
outcomeSubscriber
must signal demand in order to receive any of the signals listed above. If more thanFlow.defaultBufferSize()
writes have succeeded without demand from theoutcomeSubscriber
, then the returned subscriber will not signal further demand until theoutcomeSubscriber
has also signalled demand.The number of writes used to transfer published bytes to the BLOB value is implementation defined, and may be different from the number of byte arrays published to the returned
Subscriber
.Asynchronous tasks initiated by this method will execute under the current
AccessControlContext
of the calling thread.- Parameters:
position
- the position at which to start reading from the BLOB value that thisBlob
object represents; The first position is 1outcomeSubscriber
- aSubscriber
of write outcomes.- Returns:
- a
Subscriber
that appends bytes to thisBlob
- Throws:
SQLException
- if a database error occurs, or if this method is called on aBlob
that has been freed, or ifposition
is less than 1NullPointerException
- if theoutcomeSubscriber
argument is null.- Since:
- 20
- The
-
freeAsyncOracle
default Flow.Publisher<Void> freeAsyncOracle() throws SQLException
Returns aPublisher
that publishes the result of freeing theBlob
object and the resources that it holds. The object is invalid after the returnedPublisher
terminates withonComplete
.After the returned
Publisher
terminates withonComplete
, any attempt to invoke a method other thanBlob.free()
orfreeAsyncOracle
will result in an SQLException being thrown. CallingfreeAsyncOracle
on aBlob
object that has already been freed is treated as a no-op.Calling any method of this
Blob
exceptisEmptyLob()
,isSecureFile()
,isTemporary()
, or one defined byObject
between the time this method is called and the time when the returnedSubscriber
terminates will block.The returned publisher terminates once all subscribers have received
Subscriber.onComplete
, receivedSubscriber.onError
, or cancelled their subscription.The returned publisher will only emit
onComplete
oronError
; No items are emitted toonNext
.Asynchronous tasks initiated by this method will execute under the current
AccessControlContext
of the calling thread.- Returns:
- a
Publisher
of the result of freeing thisBlob
- Throws:
SQLException
- if a database error occurs- Since:
- 21
-
-