oracle.jdbc

## 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 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
`void` `close()` Close a previously opened BLOB.
`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()` 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.
`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

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:
  `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

Copyright © 2008, 2020, Oracle and/or its affiliates. All rights reserved.