Class ClobLocatorInputStream

java.lang.Object
java.io.InputStream
org.apache.derby.client.am.ClobLocatorInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

class ClobLocatorInputStream extends InputStream
An InputStream that will use an locator to fetch the Clob value from the server.

Closing a ByteArrayInputStream has no effect. The methods in this class can be called after the stream has been closed without generating an IOException.

This InputStream implementation is pretty basic. No buffering of data is done. Hence, for efficiency #read(byte[]) should be used instead of #read(). Marks are not supported, but it should be pretty simple to extend the implementation to support this. A more efficient skip implementation should also be straight-forward.

  • Field Details

    • connection

      private final ClientConnection connection
      Connection used to read Clob from server.
    • clob

      private final ClientClob clob
      The Clob to be accessed.
    • currentPos

      private long currentPos
      Current position in the underlying Clob. Clobs are indexed from 1
  • Constructor Details

    • ClobLocatorInputStream

      ClobLocatorInputStream(ClientConnection connection, ClientClob clob) throws SqlException
      Create an InputStream for reading the Clob value represented by the given locator based Clob object.
      Parameters:
      connection - connection to be used to read the Clob value from the server
      clob - Clob object that contains locator for the Clob value on the server.
      Throws:
      SqlException
    • ClobLocatorInputStream

      ClobLocatorInputStream(ClientConnection connection, ClientClob clob, long pos) throws SqlException
      Create an InputStream for reading the Clob value represented by the given locator based Clob object.
      Parameters:
      connection - connection to be used to read the Clob value from the server
      clob - Clob object that contains locator for the Clob value on the server.
      pos - the position inside the Clob from which the reading must begin.
      Throws:
      SqlException
  • Method Details