src/java.sql/share/classes/java/sql/Clob.java
author darcy
Wed, 25 Sep 2019 09:37:18 -0700
changeset 58338 faf791c5a710
parent 47216 71c04702a3d5
permissions -rw-r--r--
8231442: Suppress warnings on non-serializable instance fields in java.sql.* modules Reviewed-by: lancea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
22970
ba8220b73b41 8034896: Correct Clob.free javadoc typo
lancea
parents: 21278
diff changeset
     2
 * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.sql;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.Reader;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
18564
f9db68ff2cbb 8017471: Fix JDBC -Xdoclint public errors
lancea
parents: 5506
diff changeset
    31
 * The mapping in the Java™ programming language
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    32
 * for the SQL {@code CLOB} type.
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    33
 * An SQL {@code CLOB} is a built-in type
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * that stores a Character Large Object as a column value in a row of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * a database table.
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    36
 * By default drivers implement a {@code Clob} object using an SQL
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    37
 * {@code locator(CLOB)}, which means that a {@code Clob} object
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    38
 * contains a logical pointer to the SQL {@code CLOB} data rather than
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    39
 * the data itself. A {@code Clob} object is valid for the duration
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * of the transaction in which it was created.
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    41
 * <P>The {@code Clob} interface provides methods for getting the
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    42
 * length of an SQL {@code CLOB} (Character Large Object) value,
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    43
 * for materializing a {@code CLOB} value on the client, and for
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    44
 * searching for a substring or {@code CLOB} object within a
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    45
 * {@code CLOB} value.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * Methods in the interfaces {@link ResultSet},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * {@link CallableStatement}, and {@link PreparedStatement}, such as
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    48
 * {@code getClob} and {@code setClob} allow a programmer to
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    49
 * access an SQL {@code CLOB} value.  In addition, this interface
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    50
 * has methods for updating a {@code CLOB} value.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * <p>
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    52
 * All methods on the {@code Clob} interface must be
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    53
 * fully implemented if the JDBC driver supports the data type.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
public interface Clob {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
   * Retrieves the number of characters
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    62
   * in the {@code CLOB} value
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    63
   * designated by this {@code Clob} object.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
   *
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    65
   * @return length of the {@code CLOB} in characters
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
   * @exception SQLException if there is an error accessing the
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    67
   *            length of the {@code CLOB} value
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    68
   * @exception SQLFeatureNotSupportedException if the JDBC driver
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    69
   *            does not support this method
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
   * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
  long length() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
   * Retrieves a copy of the specified substring
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    76
   * in the {@code CLOB} value
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    77
   * designated by this {@code Clob} object.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
   * The substring begins at position
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    79
   * {@code pos} and has up to {@code length} consecutive
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
   * characters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
   * @param pos the first character of the substring to be extracted.
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    83
   *        The first character is at position 1.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
   * @param length the number of consecutive characters to be copied;
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    85
   *        the value for length must be 0 or greater
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    86
   * @return a {@code String} that is the specified substring in
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    87
   *         the {@code CLOB} value designated by this {@code Clob} object
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
   * @exception SQLException if there is an error accessing the
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    89
   *            {@code CLOB} value; if pos is less than 1 or length is
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    90
   *            less than 0
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    91
   * @exception SQLFeatureNotSupportedException if the JDBC driver
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    92
   *            does not support this method
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
   * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
  String getSubString(long pos, int length) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
  /**
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    98
   * Retrieves the {@code CLOB} value designated by this {@code Clob}
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    99
   * object as a {@code java.io.Reader} object (or as a stream of
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
   * characters).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
   *
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   102
   * @return a {@code java.io.Reader} object containing the
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   103
   *         {@code CLOB} data
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
   * @exception SQLException if there is an error accessing the
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   105
   *            {@code CLOB} value
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   106
   * @exception SQLFeatureNotSupportedException if the JDBC driver
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   107
   *            does not support this method
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
   * @see #setCharacterStream
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
   * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
  java.io.Reader getCharacterStream() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
  /**
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   114
   * Retrieves the {@code CLOB} value designated by this {@code Clob}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
   * object as an ascii stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
   *
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   117
   * @return a {@code java.io.InputStream} object containing the
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   118
   *         {@code CLOB} data
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
   * @exception SQLException if there is an error accessing the
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   120
   *            {@code CLOB} value
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   121
   * @exception SQLFeatureNotSupportedException if the JDBC driver
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   122
   *            does not support this method
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
   * @see #setAsciiStream
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
   * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
  java.io.InputStream getAsciiStream() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
   * Retrieves the character position at which the specified substring
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   130
   * {@code searchstr} appears in the SQL {@code CLOB} value
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   131
   * represented by this {@code Clob} object.  The search
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   132
   * begins at position {@code start}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
   * @param searchstr the substring for which to search
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   135
   * @param start the position at which to begin searching;
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   136
   *        the first position is 1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
   * @return the position at which the substring appears or -1 if it is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
   *         present; the first position is 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
   * @exception SQLException if there is an error accessing the
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   140
   *            {@code CLOB} value or if pos is less than 1
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   141
   * @exception SQLFeatureNotSupportedException if the JDBC driver
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   142
   *            does not support this method
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
   * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
  long position(String searchstr, long start) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
   * Retrieves the character position at which the specified
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   149
   * {@code Clob} object {@code searchstr} appears in this
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   150
   * {@code Clob} object.  The search begins at position
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   151
   * {@code start}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
   *
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   153
   * @param searchstr the {@code Clob} object for which to search
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
   * @param start the position at which to begin searching; the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
   *              position is 1
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   156
   * @return the position at which the {@code Clob} object appears
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   157
   *         or -1 if it is not present; the first position is 1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
   * @exception SQLException if there is an error accessing the
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   159
   *            {@code CLOB} value or if start is less than 1
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   160
   * @exception SQLFeatureNotSupportedException if the JDBC driver
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   161
   *            does not support this method
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
   * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
  long position(Clob searchstr, long start) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    //---------------------------- jdbc 3.0 -----------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    /**
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   169
     * Writes the given Java {@code String} to the {@code CLOB}
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   170
     * value that this {@code Clob} object designates at the position
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   171
     * {@code pos}. The string will overwrite the existing characters
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   172
     * in the {@code Clob} object starting at the position
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   173
     * {@code pos}.  If the end of the {@code Clob} value is reached
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   174
     * while writing the given string, then the length of the {@code Clob}
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 18564
diff changeset
   175
     * value will be increased to accommodate the extra characters.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * <p>
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   177
     * <b>Note:</b> If the value specified for {@code pos}
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   178
     * is greater than the length+1 of the {@code CLOB} value then the
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   179
     * behavior is undefined. Some JDBC drivers may throw an
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   180
     * {@code SQLException} while other drivers may support this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     *
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   183
     * @param pos the position at which to start writing to the {@code CLOB}
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   184
     *        value that this {@code Clob} object represents;
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   185
     *        the first position is 1.
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   186
     * @param str the string to be written to the {@code CLOB}
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   187
     *        value that this {@code Clob} designates
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * @return the number of characters written
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * @exception SQLException if there is an error accessing the
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   190
     *            {@code CLOB} value or if pos is less than 1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     *
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   192
     * @exception SQLFeatureNotSupportedException if the JDBC driver
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   193
     *            does not support this method
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    int setString(long pos, String str) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    /**
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   199
     * Writes {@code len} characters of {@code str}, starting
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   200
     * at character {@code offset}, to the {@code CLOB} value
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   201
     * that this {@code Clob} represents.
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   202
     * The string will overwrite the existing characters
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   203
     * in the {@code Clob} object starting at the position
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   204
     * {@code pos}.  If the end of the {@code Clob} value is reached
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   205
     * while writing the given string, then the length of the {@code Clob}
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 18564
diff changeset
   206
     * value will be increased to accommodate the extra characters.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * <p>
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   208
     * <b>Note:</b> If the value specified for {@code pos}
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   209
     * is greater than the length+1 of the {@code CLOB} value then the
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   210
     * behavior is undefined. Some JDBC drivers may throw an
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   211
     * {@code SQLException} while other drivers may support this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * @param pos the position at which to start writing to this
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   215
     *        {@code CLOB} object; The first position  is 1
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   216
     * @param str the string to be written to the {@code CLOB}
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   217
     *        value that this {@code Clob} object represents
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   218
     * @param offset the offset into {@code str} to start reading
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     *        the characters to be written
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * @param len the number of characters to be written
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * @return the number of characters written
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * @exception SQLException if there is an error accessing the
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   223
     *            {@code CLOB} value or if pos is less than 1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     *
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   225
     * @exception SQLFeatureNotSupportedException if the JDBC driver
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   226
     *            does not support this method
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    int setString(long pos, String str, int offset, int len) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * Retrieves a stream to be used to write Ascii characters to the
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   233
     * {@code CLOB} value that this {@code Clob} object represents,
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   234
     * starting at position {@code pos}.  Characters written to the stream
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * will overwrite the existing characters
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   236
     * in the {@code Clob} object starting at the position
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   237
     * {@code pos}.  If the end of the {@code Clob} value is reached
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   238
     * while writing characters to the stream, then the length of the {@code Clob}
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 18564
diff changeset
   239
     * value will be increased to accommodate the extra characters.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * <p>
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   241
     * <b>Note:</b> If the value specified for {@code pos}
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   242
     * is greater than the length+1 of the {@code CLOB} value then the
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   243
     * behavior is undefined. Some JDBC drivers may throw an
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   244
     * {@code SQLException} while other drivers may support this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * @param pos the position at which to start writing to this
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   248
     *        {@code CLOB} object; The first position is 1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * @return the stream to which ASCII encoded characters can be written
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * @exception SQLException if there is an error accessing the
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   251
     *            {@code CLOB} value or if pos is less than 1
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   252
     * @exception SQLFeatureNotSupportedException if the JDBC driver
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   253
     *            does not support this method
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * @see #getAsciiStream
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    java.io.OutputStream setAsciiStream(long pos) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * Retrieves a stream to be used to write a stream of Unicode characters
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   262
     * to the {@code CLOB} value that this {@code Clob} object
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   263
     * represents, at position {@code pos}. Characters written to the stream
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * will overwrite the existing characters
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   265
     * in the {@code Clob} object starting at the position
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   266
     * {@code pos}.  If the end of the {@code Clob} value is reached
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   267
     * while writing characters to the stream, then the length of the {@code Clob}
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 18564
diff changeset
   268
     * value will be increased to accommodate the extra characters.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     * <p>
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   270
     * <b>Note:</b> If the value specified for {@code pos}
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   271
     * is greater than the length+1 of the {@code CLOB} value then the
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   272
     * behavior is undefined. Some JDBC drivers may throw an
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   273
     * {@code SQLException} while other drivers may support this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * @param  pos the position at which to start writing to the
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   277
     *        {@code CLOB} value; The first position is 1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     * @return a stream to which Unicode encoded characters can be written
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * @exception SQLException if there is an error accessing the
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   281
     *            {@code CLOB} value or if pos is less than 1
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   282
     * @exception SQLFeatureNotSupportedException if the JDBC driver
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   283
     *            does not support this method
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * @see #getCharacterStream
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    java.io.Writer setCharacterStream(long pos) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    /**
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   291
     * Truncates the {@code CLOB} value that this {@code Clob}
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   292
     * designates to have a length of {@code len}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * characters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * <p>
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   295
     * <b>Note:</b> If the value specified for {@code pos}
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   296
     * is greater than the length+1 of the {@code CLOB} value then the
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   297
     * behavior is undefined. Some JDBC drivers may throw an
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   298
     * {@code SQLException} while other drivers may support this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     *
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   301
     * @param len the length, in characters, to which the {@code CLOB} value
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     *        should be truncated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * @exception SQLException if there is an error accessing the
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   304
     *            {@code CLOB} value or if len is less than 0
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     *
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   306
     * @exception SQLFeatureNotSupportedException if the JDBC driver
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   307
     *            does not support this method
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
    void truncate(long len) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
    /**
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   313
     * This method releases the resources that the {@code Clob} object
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   314
     * holds.  The object is invalid once the {@code free} method
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     * is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * <p>
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   317
     * After {@code free} has been called, any attempt to invoke a
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   318
     * method other than {@code free} will result in a {@code SQLException}
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   319
     * being thrown.  If {@code free} is called multiple times, the subsequent
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   320
     * calls to {@code free} are treated as a no-op.
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 22970
diff changeset
   321
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     * @throws SQLException if an error occurs releasing
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   323
     *         the Clob's resources
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     *
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   325
     * @exception SQLFeatureNotSupportedException if the JDBC driver
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   326
     *            does not support this method
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    void free() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    /**
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   332
     * Returns a {@code Reader} object that contains
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   333
     * a partial {@code Clob} value, starting with the character
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   334
     * specified by pos, which is length characters in length.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     * @param pos the offset to the first character of the partial value to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     * be retrieved.  The first character in the Clob is at position 1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * @param length the length in characters of the partial value to be retrieved.
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   339
     * @return {@code Reader} through which
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   340
     *         the partial {@code Clob} value can be read.
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   341
     * @throws SQLException if pos is less than 1;
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   342
     *         or if pos is greater than the number of characters
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   343
     *         in the {@code Clob};
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   344
     *         or if pos + length is greater than the number of
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   345
     *         characters in the {@code Clob}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     *
30797
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   347
     * @exception SQLFeatureNotSupportedException if the JDBC driver
9cf3d0361db4 8040147: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   348
     *            does not support this method
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    Reader getCharacterStream(long pos, long length) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
}