Package oracle.jdbc

Interface OracleBfile

All Known Implementing Classes:
BFILE

public interface OracleBfile
This interface defines methods for Oracle specific Bfile. BFILE is an Oracle proprietary data type that provides read-only access to data located outside the database tablespaces.
Since:
11.2.0.3.0
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Deprecated, for removal: This API element is subject to removal in a future version.
    The name of this method is anticipated to conflict with a future version of the JDBC Specification.
    void
    Close the FILE.
    void
    Close a previously opened external LOB.
    boolean
    Find out if a given BFILE (whose locator) points to a file that actually exists on the server's filesystem.
    Retrieve the entire BFILE as a stream.
    getBinaryStream(long pos)
    Read from the external LOB as a stream at the requested position.
    byte[]
    getBytes(long pos, int length)
    Return a copy of the contents of the BFILE at the requested position.
    int
    getBytes(long pos, int length, byte[] buf)
    Copy the contents of the BFILE at the requested position to supplied buffer.
    Gets the Bfile's directory alias.
    Gets the Bfile's file name.
    boolean
    Find out whether a BFILE was opened
    default boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    The name of this method is anticipated to conflict with a future version of the JDBC Specification.
    boolean
    Check whether the external LOB is opened.
    long
    The length of the BFILE in bytes.
    default void
    Deprecated, for removal: This API element is subject to removal in a future version.
    The name of this method is anticipated to conflict with a future version of the JDBC Specification.
    void
    Open the FILE.
    void
    Open an external LOB in the indicated mode.
    long
    position(byte[] pattern, long start)
    Determine the byte position at which the given byte pattern
    long
    position(OracleBfile pattern, long start)
    Determine the byte position at which the given pattern
    publisherOracle(long position)
    Returns a Publisher that publishes the content of this BFile beginning at the specified position.
    default Flow.Publisher<byte[]>
    publisherOracle(long position, ErrorSet continueOnErrorSet)
    Returns a Publisher that publishes the content of this BFile beginning at the specified position.
  • Method Details

    • length

      long length() throws SQLException
      The length of the BFILE in bytes.
      Returns:
      length of the BFILE in bytes
      Throws:
      SQLException
    • getBytes

      byte[] getBytes(long pos, int length) throws SQLException
      Return a copy of the contents of the BFILE at the requested position.
      Parameters:
      pos - is the first byte of the bfile to be extracted.(1-based)
      length - is the number of consecutive bytes to be copied.
      Returns:
      a byte array containing a portion of the BFILE
      Throws:
      SQLException
    • getBytes

      int getBytes(long pos, int length, byte[] buf) throws SQLException
      Copy the contents of the BFILE at the requested position to supplied buffer.
      Parameters:
      pos - is the first byte of the bfile to be extracted. (1-based)
      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 BFILE
      Throws:
      SQLException
    • getBinaryStream

      InputStream getBinaryStream() throws SQLException
      Retrieve the entire BFILE as a stream.
      Returns:
      a stream containing the BFILE data
      Throws:
      SQLException
    • getBinaryStream

      InputStream getBinaryStream(long pos) throws SQLException
      Read from the external LOB as a stream at the requested position.
      Parameters:
      pos - is the position of data to be read. The first position is 1.
      Returns:
      an input stream to read data from the BFILE
      Throws:
      SQLException
      Since:
      8.2.0
    • position

      long position(byte[] pattern, long start) throws SQLException
      Determine the byte position at which the given byte pattern
      Parameters:
      pattern - is the pattern to search for.
      start - is the position at which to begin searching. (1-based)
      Returns:
      the position at which the pattern appears, else -1.
      Throws:
      SQLException
    • position

      long position(OracleBfile pattern, long start) throws SQLException
      Determine the byte position at which the given pattern
      Parameters:
      pattern - is the pattern to search for.
      start - is the position at which to begin searching. (1-based)
      Returns:
      the position at which the pattern appears, else -1.
      Throws:
      SQLException
    • getName

      String getName() throws SQLException
      Gets the Bfile's file name.
      Returns:
      The file name.
      Throws:
      SQLException
    • getDirAlias

      String getDirAlias() throws SQLException
      Gets the Bfile's directory alias.
      Returns:
      The directory alias name.
      Throws:
      SQLException
    • openFile

      void openFile() throws SQLException
      Open the FILE.
      Throws:
      SQLException
    • isFileOpen

      boolean isFileOpen() throws SQLException
      Find out whether a BFILE was opened
      Returns:
      true if the BFILE was opened, false if it was not opened.
      Throws:
      SQLException
    • fileExists

      boolean fileExists() throws SQLException
      Find out if a given BFILE (whose locator) points to a file that actually exists on the server's filesystem.
      Returns:
      true if the physical file exists, false if it does not exist.
      Throws:
      SQLException
    • closeFile

      void closeFile() throws SQLException
      Close the FILE.
      Throws:
      SQLException
    • open

      @Deprecated(since="23.5", forRemoval=true) default void open(LargeObjectAccessMode mode) throws SQLException
      Deprecated, for removal: This API element is subject to removal in a future version.
      The name of this method is anticipated to conflict with a future version of the JDBC Specification. This method will be removed in a future version of the Oracle JDBC Driver. Any calls to this method should be replaced with a call to openLob(LargeObjectAccessMode), which provides the exact same behavior.
      Open an external LOB in the indicated mode. Valid modes include MODE_READONLY only. It is an error to open the same LOB twice.
      Throws:
      SQLException
      Since:
      11.2.0.3.0
    • openLob

      void openLob(LargeObjectAccessMode mode) throws SQLException
      Open an external LOB in the indicated mode. Valid modes include MODE_READONLY only. It is an error to open the same LOB twice.
      Throws:
      SQLException
      Since:
      23.5
    • close

      @Deprecated(since="23.5", forRemoval=true) default void close() throws SQLException
      Deprecated, for removal: This API element is subject to removal in a future version.
      The name of this method is anticipated to conflict with a future version of the JDBC Specification. This method will be removed in a future version of the Oracle JDBC Driver. Any calls to this method should be replaced with a call to closeLob(), which provides the exact same behavior.
      Close a previously opened external LOB.
      Throws:
      SQLException
      Since:
      8.2.0
    • closeLob

      void closeLob() throws SQLException
      Close a previously opened external LOB.
      Throws:
      SQLException
      Since:
      23.5
    • isOpen

      @Deprecated(since="23.5", forRemoval=true) default boolean isOpen() throws SQLException
      Deprecated, for removal: This API element is subject to removal in a future version.
      The name of this method is anticipated to conflict with a future version of the JDBC Specification. This method will be removed in a future version of the Oracle JDBC Driver. Any calls to this method should be replaced with a call to isOpenLob(), which provides the exact same behavior.
      Check whether the external LOB is opened.
      Returns:
      true if the LOB is opened.
      Throws:
      SQLException
      Since:
      8.2.0
    • isOpenLob

      boolean isOpenLob() throws SQLException
      Check whether the external LOB is opened.
      Returns:
      true if the LOB is opened.
      Throws:
      SQLException
      Since:
      23.5
    • publisherOracle

      Flow.Publisher<byte[]> publisherOracle(long position) throws SQLException
      Returns a Publisher that publishes the content of this BFile 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 BFile except fileExists(), getDirAlias(), getName(), 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 BFILE value that this Bfile object represents; The first position is 1
      Returns:
      a Publisher of the content of this BFile
      Throws:
      SQLException - if a database error occurs or if position is less than 1
      Since:
      21
    • publisherOracle

      default Flow.Publisher<byte[]> publisherOracle(long position, ErrorSet continueOnErrorSet) throws SQLException
      Returns a Publisher that publishes the content of this BFile 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 BFile except fileExists(), getDirAlias(), getName(), 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 BFILE value that this Bfile 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 BFile
      Throws:
      SQLException - if a database error occurs or if position is less than 1
      Since:
      23