org.firebirdsql.jdbc

## Class FBClob

- java.lang.Object
- - org.firebirdsql.jdbc.FBClob

- All Implemented Interfaces:
    java.sql.Clob, java.sql.NClob

      public class FBClob
      extends java.lang.Object
      implements java.sql.Clob, java.sql.NClob

  The mapping in the JavaTM programming language for the SQL CLOB type. An SQL CLOB is a built-in type that stores a Character Large Object as a column value in a row of a database table. CLOBS are not currently supported by the Jaybird driver.

  The Clob interface provides methods for getting the length of an SQL CLOB (Character Large Object) value, for materializing a CLOB value on the client, and for searching for a substring or CLOB object within a CLOB value. Methods in the interfaces ResultSet, CallableStatement, and PreparedStatement, such as getClob and setClob allow a programmer to access an SQL CLOB value. In addition, this interface has methods for updating a CLOB value.

  This class also implements `NClob` so it can be used with the `set/get/updateNClob` methods transparently. It technically does not conform to the JDBC requirements for `NClob`.

  Version:
    1.0
  Author:
    David Jencks

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FBClob(FBBlob blob)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `copyCharacterStream(java.io.Reader characterStream)`
    `void` | `copyCharacterStream(java.io.Reader characterStream, long length)` Copy data from a character stream into this Blob.
    `void` | `free()`
    `java.io.InputStream` | `getAsciiStream()` Gets the `CLOB` value designated by this `Clob` object as a stream of Ascii bytes.
    `java.io.Reader` | `getCharacterStream()` Gets the `CLOB` value designated by this `Clob` object as a Unicode stream.
    `java.io.Reader` | `getCharacterStream(long pos, long length)`
    `java.lang.String` | `getSubString(long pos, int length)` Returns a copy of the specified substring in the `CLOB` value designated by this `Clob` object.
    `FBBlob` | `getWrappedBlob()` Retrieves the FBBlob wrapped by this FBClob.
    `long` | `length()` Returns the number of characters in the `CLOB` value designated by this `Clob` object.
    `long` | `position(java.sql.Clob searchstr, long start)` Determines the character position at which the specified `Clob` object `searchstr` appears in this `Clob` object.
    `long` | `position(java.lang.String searchstr, long start)` Determines the character position at which the specified substring `searchstr` appears in the SQL `CLOB` value represented by this `Clob` object.
    `java.io.OutputStream` | `setAsciiStream(long pos)` Set a byte stream to write the contents of this Clob.
    `java.io.Writer` | `setCharacterStream(long position)` Create a writer to add character data to this Clob.
    `int` | `setString(long pos, java.lang.String str)`
    `int` | `setString(long pos, java.lang.String str, int offset, int len)`
    `void` | `truncate(long param1)` This operation is not currently supported Truncate this `Clob` to a given length.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FBClob

          public FBClob(FBBlob blob)

  - ### Method Detail

    - #### length

          public long length()
                      throws java.sql.SQLException

      Returns the number of characters in the `CLOB` value designated by this `Clob` object.
      Specified by:
        `length` in interface `java.sql.Clob`
      Returns:
        length of the `CLOB` in characters
      Throws:
        `java.sql.SQLException` - if there is an error accessing the length of the `CLOB`
      Since:
        1.2
      See Also:
        What Is in the JDBC 2.0 API

    - #### truncate

          public void truncate(long param1)
                        throws java.sql.SQLException

      This operation is not currently supported Truncate this `Clob` to a given length.
      Specified by:
        `truncate` in interface `java.sql.Clob`
      Parameters:
        `param1` - The length to truncate this Clob to
      Throws:
        `java.sql.SQLException` - this operation is not supported

    - #### getSubString

          public java.lang.String getSubString(long pos,
                                      int length)
                                        throws java.sql.SQLException

      Returns a copy of the specified substring in the `CLOB` value designated by this `Clob` object. The substring begins at position `pos` and has up to `length` consecutive characters.
      Specified by:
        `getSubString` in interface `java.sql.Clob`
      Parameters:
        `pos` - the first character of the substring to be extracted. The first character is at position 1.
        `length` - the number of consecutive characters to be copied
      Returns:
        a `String` that is the specified substring in the `CLOB` value designated by this `Clob` object
      Throws:
        `java.sql.SQLException` - if there is an error accessing the `CLOB`
      Since:
        1.2
      See Also:
        What Is in the JDBC 2.0 API

    - #### getCharacterStream

          public java.io.Reader getCharacterStream()
                                            throws java.sql.SQLException

      Gets the `CLOB` value designated by this `Clob` object as a Unicode stream.
      Specified by:
        `getCharacterStream` in interface `java.sql.Clob`
      Returns:
        a Unicode stream containing the `CLOB` data
      Throws:
        `java.sql.SQLException` - if there is an error accessing the `CLOB` value
      Since:
        1.2
      See Also:
        What Is in the JDBC 2.0 API

    - #### getAsciiStream

          public java.io.InputStream getAsciiStream()
                                             throws java.sql.SQLException

      Gets the `CLOB` value designated by this `Clob` object as a stream of Ascii bytes.
      Specified by:
        `getAsciiStream` in interface `java.sql.Clob`
      Returns:
        an ascii stream containing the `CLOB` data
      Throws:
        `java.sql.SQLException` - if there is an error accessing the `CLOB` value
      Since:
        1.2
      See Also:
        What Is in the JDBC 2.0 API

    - #### position

          public long position(java.lang.String searchstr,
                      long start)
                        throws java.sql.SQLException

      Determines the character position at which the specified substring `searchstr` appears in the SQL `CLOB` value represented by this `Clob` object. The search begins at position `start`.
      Specified by:
        `position` in interface `java.sql.Clob`
      Parameters:
        `searchstr` - the substring for which to search
        `start` - the position at which to begin searching; the first position is 1
      Returns:
        the position at which the substring appears, else -1; the first position is 1
      Throws:
        `java.sql.SQLException` - if there is an error accessing the `CLOB` value
      Since:
        1.2
      See Also:
        What Is in the JDBC 2.0 API

    - #### position

          public long position(java.sql.Clob searchstr,
                      long start)
                        throws java.sql.SQLException

      Determines the character position at which the specified `Clob` object `searchstr` appears in this `Clob` object. The search begins at position `start`.
      Specified by:
        `position` in interface `java.sql.Clob`
      Parameters:
        `searchstr` - the `Clob` object for which to search
        `start` - the position at which to begin searching; the first position is 1
      Returns:
        the position at which the `Clob` object appears, else -1; the first position is 1
      Throws:
        `java.sql.SQLException` - if there is an error accessing the `CLOB` value
      Since:
        1.2
      See Also:
        What Is in the JDBC 2.0 API

    - #### setString

          public int setString(long pos,
                      java.lang.String str)
                        throws java.sql.SQLException

      Jaybird currently does not support this method.

      Specified by:
        `setString` in interface `java.sql.Clob`
      Throws:
        `java.sql.SQLException`

    - #### setString

          public int setString(long pos,
                      java.lang.String str,
                      int offset,
                      int len)
                        throws java.sql.SQLException

      Jaybird currently does not support this method.

      Specified by:
        `setString` in interface `java.sql.Clob`
      Throws:
        `java.sql.SQLException`

    - #### setAsciiStream

          public java.io.OutputStream setAsciiStream(long pos)
                                              throws java.sql.SQLException

      Set a byte stream to write the contents of this Clob.
      Specified by:
        `setAsciiStream` in interface `java.sql.Clob`
      Parameters:
        `pos` - The position at which writing is to start.
      Returns:
      Throws:
        `java.sql.SQLException` -

    - #### setCharacterStream

          public java.io.Writer setCharacterStream(long position)
                                            throws java.sql.SQLException

      Create a writer to add character data to this Clob.
      Specified by:
        `setCharacterStream` in interface `java.sql.Clob`
      Parameters:
        `position` - The position at which the Writer should start writing
      Returns:
      Throws:
        `java.sql.SQLException` -

    - #### free

          public void free()
                    throws java.sql.SQLException

      Specified by:
        `free` in interface `java.sql.Clob`
      Throws:
        `java.sql.SQLException`

    - #### getCharacterStream

          public java.io.Reader getCharacterStream(long pos,
                                          long length)
                                            throws java.sql.SQLException

      Specified by:
        `getCharacterStream` in interface `java.sql.Clob`
      Throws:
        `java.sql.SQLException`

    - #### copyCharacterStream

          public void copyCharacterStream(java.io.Reader characterStream,
                                 long length)
                                   throws java.sql.SQLException

      Copy data from a character stream into this Blob.

      Calling with length `-1` is equivalent to calling `copyCharacterStream(Reader)`.

      Parameters:
        `characterStream` - the source of data to copy
        `length` - The maximum number of bytes to copy, or `-1` to read the whole stream
      Throws:
        `java.sql.SQLException`

    - #### copyCharacterStream

          public void copyCharacterStream(java.io.Reader characterStream)
                                   throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getWrappedBlob

          public FBBlob getWrappedBlob()
                                throws java.sql.SQLException

      Retrieves the FBBlob wrapped by this FBClob.
      Returns:
        FBBlob instance
      Throws:
        `java.sql.SQLException`

Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.