Class ClobLocatorReader

java.lang.Object
java.io.Reader
org.apache.derby.client.am.ClobLocatorReader
All Implemented Interfaces:
Closeable, AutoCloseable, Readable

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

This Reader implementation is pretty basic. No buffering of data is done. Hence, for efficiency #read(char[]) 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
    • maxPos

      private final long maxPos
      Position in Clob where to stop reading. maxPos starts counting from 1.
    • isClosed

      private boolean isClosed
      Stores the information to whether this Reader has been closed or not. Is set to true if close() has been called. Is false otherwise.
  • Constructor Details

    • ClobLocatorReader

      ClobLocatorReader(ClientConnection connection, ClientClob clob) throws SqlException
      Create an Reader 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
    • ClobLocatorReader

      ClobLocatorReader(ClientConnection connection, ClientClob clob, long pos, long len) throws SqlException
      Create an Reader 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 offset to the first character of the partial value to be retrieved.
      len - The length in characters of the partial value to be retrieved.
      Throws:
      SqlException
  • Method Details