Package oracle.jdbc

Interface OracleBlob

  • All Superinterfaces:
    java.sql.Blob
    All Known Implementing Classes:
    BLOB

    public interface OracleBlob
    extends java.sql.Blob
    This interface defines the Oracle extensions to the standard JDBC interface Blob .

    Generally any new code should avoid the direct use of the class BLOB. For variable declarations use the interface Blob or this interface as required. Instead of the static methods BLOB.createTemporary(java.sql.Connection, boolean, int) and BLOB.empty_lob() please use Connection.createBlob() and BLOB.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 java.util.concurrent.Flow.Publisher<java.lang.Void> freeAsyncOracle()
      Returns a Publisher that publishes the result of freeing the Blob object and the resources that it holds.
      java.io.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 an empty blob.
      boolean isOpen()
      Check whether the BLOB is opened.
      boolean isSecureFile()
      Returns true 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.
      java.util.concurrent.Flow.Publisher<byte[]> publisherOracle​(long position)
      Returns a Publisher that publishes the content of this Blob beginning at the specified position.
      default java.util.concurrent.Flow.Publisher<byte[]> publisherOracle​(long position, ErrorSet continueOnErrorSet)
      Returns a Publisher that publishes the content of this Blob beginning at the specified position.
      java.util.concurrent.Flow.Subscriber<byte[]> subscriberOracle​(long position)
      Returns a Subscriber that will append the published bytes to this Blob beginning at the specified position.
      java.util.concurrent.Flow.Subscriber<byte[]> subscriberOracle​(long position, java.util.concurrent.Flow.Subscriber<java.lang.Long> outcomeSubscriber)
      Returns a Subscriber that will append the published bytes to this Blob beginning at the specified position.
      default java.util.concurrent.Flow.Subscriber<byte[]> subscriberOracle​(long position, java.util.concurrent.Flow.Subscriber<java.lang.Long> outcomeSubscriber, ErrorSet continueOnErrorSet)
      Returns a Subscriber that will append the published bytes to this Blob beginning at the specified position.
      default java.util.concurrent.Flow.Subscriber<byte[]> subscriberOracle​(long position, ErrorSet continueOnErrorSet)
      Returns a Subscriber that will append the published bytes to this Blob beginning at the specified position.
      java.sql.SQLXML toSQLXML()
      Returns an object which implements java.sql.SQLXML with content take from this Clob.
      java.sql.SQLXML toSQLXML​(int csid)
      Returns an object which implements 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 java.sql.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:
        java.sql.SQLException
        Since:
        8.2.0
      • close

        void close()
            throws java.sql.SQLException
        Close a previously opened BLOB.
        Throws:
        java.sql.SQLException
        Since:
        8.2.0
      • isOpen

        boolean isOpen()
                throws java.sql.SQLException
        Check whether the BLOB is opened.
        Returns:
        true if the LOB is opened.
        Throws:
        java.sql.SQLException
        Since:
        8.2.0
      • getBytes

        int getBytes​(long pos,
                     int length,
                     byte[] buf)
              throws java.sql.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 have the extracted bytes.
        Returns:
        a byte array containing a portion of the BLOB
        Throws:
        java.sql.SQLException
      • isEmptyLob

        boolean isEmptyLob()
                    throws java.sql.SQLException
        Return true if the lob locator points to an empty blob. False if it does not.
        Returns:
        true if the lob locator points to an empty blob. False if it does not.
        Throws:
        java.sql.SQLException
        Since:
        8.1.7
      • isSecureFile

        boolean isSecureFile()
                      throws java.sql.SQLException
        Returns true 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 and false otherwise.
        Throws:
        java.sql.SQLException
      • getBinaryStream

        java.io.InputStream getBinaryStream​(long pos)
                                     throws java.sql.SQLException
        Read from the BLOB as a stream at the requested position.
        Parameters:
        pos - is the position data to be read.
        Returns:
        an input stream to read data from the BLOB
        Throws:
        java.sql.SQLException
        Since:
        8.2.0
      • isTemporary

        boolean isTemporary()
                     throws java.sql.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:
        java.sql.SQLException
        Since:
        8.2.0
      • toSQLXML

        java.sql.SQLXML toSQLXML()
                          throws java.sql.SQLException
        Returns an object which implements java.sql.SQLXML with content take from this Clob.
        Returns:
        the new SQLXML object
        Throws:
        java.sql.SQLException
        Since:
        12.2
      • toSQLXML

        java.sql.SQLXML toSQLXML​(int csid)
                          throws java.sql.SQLException
        Returns an object which implements java.sql.SQLXML with content taken from this Blob.
        Returns:
        the new SQLXML object
        Throws:
        java.sql.SQLException
        Since:
        12.2
      • publisherOracle

        java.util.concurrent.Flow.Publisher<byte[]> publisherOracle​(long position)
                                                             throws java.sql.SQLException
        Returns a Publisher that publishes the content of this Blob beginning at the specified position. The argument to each call to Subscriber.onNext will contain an implementation defined number of bytes.

        Calling any method of this Blob except isEmptyLob(), isSecureFile(), isTemporary(), or one defined by Object 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, received Subscriber.onError, or cancelled their subscription.

        An invocation of this method is equivalent to invoking publisherOracle(long, ErrorSet) with the ErrorSet configured by OracleCommonConnection.continueOnError(ErrorSet).

        Parameters:
        position - the position at which to start reading from the BLOB value that this Blob object represents; The first position is 1
        Returns:
        a Publisher of the content of this Blob
        Throws:
        java.sql.SQLException - if a database error occurs, or if this method is called on a Blob that has been freed, or if position is less than 1
        Since:
        21
      • publisherOracle

        default java.util.concurrent.Flow.Publisher<byte[]> publisherOracle​(long position,
                                                                            ErrorSet continueOnErrorSet)
                                                                     throws java.sql.SQLException
        Returns a Publisher that publishes the content of this Blob beginning at the specified position. The argument to each call to Subscriber.onNext will contain an implementation defined number of bytes.

        Calling any method of this Blob except isEmptyLob(), isSecureFile(), isTemporary(), or one defined by Object 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, received Subscriber.onError, or cancelled their subscription.

        Upon signalling demand to the returned Publisher, LOB read operations will enter into the execution pipeline of this LOB's connection. If an operation fails with an error not in the continueOnErrorSet, the pipeline will abort all subsequent asynchronous operations, up to the next #resume().

        Parameters:
        position - the position at which to start reading from the BLOB value that this Blob object represents; The first position is 1
        continueOnErrorSet - Set of errors which do not cause subsequent operations to be aborted. Not null.
        Returns:
        a Publisher of the content of this Blob
        Throws:
        java.sql.SQLException - if a database error occurs, or if this method is called on a Blob that has been freed, or if position is less than 1
        java.lang.NullPointerException - if the continueOnErrorSet is null
        java.lang.IllegalArgumentException - if the continueOnErrorSet is not supported. At a minimum, all drivers must support ErrorSet.NO_ERRORS and ErrorSet.ALL_ERRORS
        Since:
        23
      • subscriberOracle

        java.util.concurrent.Flow.Subscriber<byte[]> subscriberOracle​(long position)
                                                               throws java.sql.SQLException
        Returns a Subscriber that will append the published bytes to this Blob beginning at the specified position.

        Calling any method of this Blob except isEmptyLob(), isSecureFile(), isTemporary(), or one defined by Object between the time this method is called and the time when the returned Subscriber terminates will block.

        The returned Subscriber terminates once Subscriber.onComplete is received, Subscriber.onError is received, or its subscription is cancelled.

        An invocation of this method is equivalent to invoking subscriberOracle(long, ErrorSet) with the ErrorSet configured by OracleCommonConnection.continueOnError(ErrorSet).

        Parameters:
        position - the position at which to start reading from the BLOB value that this Blob object represents; The first position is 1
        Returns:
        a Subscriber that appends bytes to this Blob
        Throws:
        java.sql.SQLException - if a database error occurs, or if this method is called on a Blob that has been freed, or if position is less than 1
        Since:
        21
      • subscriberOracle

        default java.util.concurrent.Flow.Subscriber<byte[]> subscriberOracle​(long position,
                                                                              ErrorSet continueOnErrorSet)
                                                                       throws java.sql.SQLException
        Returns a Subscriber that will append the published bytes to this Blob beginning at the specified position.

        Calling any method of this Blob except isEmptyLob(), isSecureFile(), isTemporary(), or one defined by Object between the time this method is called and the time when the returned Subscriber terminates will block.

        The returned Subscriber terminates once Subscriber.onComplete is received, Subscriber.onError is received, or its subscription is cancelled.

        Upon receiving bytes from an upstream Publisher, LOB write operations will enter into the execution pipeline of this LOB's connection. If an operation fails with an error not in the continueOnErrorSet, the pipeline will abort all subsequent asynchronous operations, up to the next #resume().

        Parameters:
        position - the position at which to start reading from the BLOB value that this Blob object represents; The first position is 1
        continueOnErrorSet - Set of errors which do not cause subsequent operations to be aborted. Not null.
        Returns:
        a Subscriber that appends bytes to this Blob
        Throws:
        java.sql.SQLException - if a database error occurs, or if this method is called on a Blob that has been freed, or if position is less than 1
        Since:
        21
      • subscriberOracle

        java.util.concurrent.Flow.Subscriber<byte[]> subscriberOracle​(long position,
                                                                      java.util.concurrent.Flow.Subscriber<java.lang.Long> outcomeSubscriber)
                                                               throws java.sql.SQLException
        Returns a Subscriber that will append the published bytes to this Blob beginning at the specified position.

        Calling any method of this Blob except isEmptyLob(), isSecureFile(), isTemporary(), or one defined by Object between the time this method is called and the time when the returned Subscriber terminates will block.

        The returned Subscriber terminates once Subscriber.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 an onNext 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 of onNext.
        • The outcomeSubscriber receives an onComplete signal after the last published byte has been written successfully.
        • The outcomeSubscriber receives an onError signal with a SQLException 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 than Flow.defaultBufferSize() writes have succeeded without demand from the outcomeSubscriber, then the returned subscriber will not signal further demand until the outcomeSubscriber 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.

        An invocation of this method is equivalent to invoking subscriberOracle(long, Subscriber, ErrorSet) with the ErrorSet configured by OracleCommonConnection.continueOnError(ErrorSet).

        Parameters:
        position - the position at which to start reading from the BLOB value that this Blob object represents; The first position is 1
        outcomeSubscriber - a Subscriber of write outcomes.
        Returns:
        a Subscriber that appends bytes to this Blob
        Throws:
        java.sql.SQLException - if a database error occurs, or if this method is called on a Blob that has been freed, or if position is less than 1
        java.lang.NullPointerException - if the outcomeSubscriber argument is null.
        Since:
        21
      • subscriberOracle

        default java.util.concurrent.Flow.Subscriber<byte[]> subscriberOracle​(long position,
                                                                              java.util.concurrent.Flow.Subscriber<java.lang.Long> outcomeSubscriber,
                                                                              ErrorSet continueOnErrorSet)
                                                                       throws java.sql.SQLException
        Returns a Subscriber that will append the published bytes to this Blob beginning at the specified position.

        Calling any method of this Blob except isEmptyLob(), isSecureFile(), isTemporary(), or one defined by Object between the time this method is called and the time when the returned Subscriber terminates will block.

        The returned Subscriber terminates once Subscriber.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 an onNext 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 of onNext.
        • The outcomeSubscriber receives an onComplete signal after the last published byte has been written successfully.
        • The outcomeSubscriber receives an onError signal with a SQLException 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 than Flow.defaultBufferSize() writes have succeeded without demand from the outcomeSubscriber, then the returned subscriber will not signal further demand until the outcomeSubscriber 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.

        Upon receiving bytes from an upstream Publisher, LOB write operations will enter into the execution pipeline of this LOB's connection. If an operation fails with an error not in the continueOnErrorSet, the pipeline will abort all subsequent asynchronous operations, up to the next #resume().

        Parameters:
        position - the position at which to start reading from the BLOB value that this Blob object represents; The first position is 1
        outcomeSubscriber - a Subscriber of write outcomes.
        continueOnErrorSet - Set of errors which do not cause subsequent operations to be aborted. Not null.
        Returns:
        a Subscriber that appends bytes to this Blob
        Throws:
        java.sql.SQLException - if a database error occurs, or if this method is called on a Blob that has been freed, or if position is less than 1
        java.lang.NullPointerException - if the outcomeSubscriber argument is null.
        Since:
        23
      • freeAsyncOracle

        default java.util.concurrent.Flow.Publisher<java.lang.Void> freeAsyncOracle()
                                                                             throws java.sql.SQLException
        Returns a Publisher that publishes the result of freeing the Blob object and the resources that it holds. The object is invalid after the returned Publisher terminates with onComplete.

        After the returned Publisher terminates with onComplete, any attempt to invoke a method other than Blob.free() or freeAsyncOracle will result in an SQLException being thrown. Calling freeAsyncOracle on a Blob object that has already been freed is treated as a no-op.

        Calling any method of this Blob except isEmptyLob(), isSecureFile(), isTemporary(), or one defined by Object between the time this method is called and the time when the returned Subscriber terminates will block.

        The returned publisher terminates once all subscribers have received Subscriber.onComplete, received Subscriber.onError, or cancelled their subscription.

        The returned publisher will only emit onComplete or onError; No items are emitted to onNext.

        Returns:
        a Publisher of the result of freeing this Blob
        Throws:
        java.sql.SQLException - if a database error occurs
        Since:
        21