OSDN Git Service

2004-07-23 Bryce McKinlay <mckinlay@redhat.com>
[pf3gnuchains/gcc-fork.git] / libjava / java / sql / Clob.java
1 /* Clob.java -- Access Character Large OBjects
2    Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
3
4 This file is part of GNU Classpath.
5
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10  
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING.  If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA.
20
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library.  Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
25
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module.  An independent module is a module which is not derived from
33 or based on this library.  If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so.  If you do not wish to do so, delete this
36 exception statement from your version. */
37
38 package java.sql;
39
40 import java.io.InputStream;
41 import java.io.OutputStream;
42 import java.io.Reader;
43 import java.io.Writer;
44
45 /**
46  * This interface contains methods for accessing a SQL CLOB (Character
47  * Large OBject) type.
48  *
49  * @author Aaron M. Renn (arenn@urbanophile.com)
50  */
51 public interface Clob 
52 {
53  /**
54   * This method returns the number of characters in the CLOB.
55   *
56   * @return The number of characters in the CLOB.
57   * @exception SQLException If an error occurs.
58   * @since 1.2
59   */
60   long length() throws SQLException;
61
62   /**
63    * This method returns the specified portion of the CLOB as a 
64    * <code>String</code>. 
65    *
66    * @param offset The index into the CLOB (index values start at 1) to 
67    *        start returning characters from.
68    * @param length The requested number of characters to return.
69    * @return The requested CLOB section, as a <code>String</code>.
70    * @exception SQLException If an error occurs.
71    * @since 1.2
72    */
73   String getSubString(long pos, int length) throws SQLException;
74
75   /**
76    * This method returns a character stream that reads the contents of the
77    * CLOB.
78    *
79    * @return A character stream to read the CLOB's contents.
80    * @exception SQLException If an error occurs.
81    * @since 1.2
82    */
83   Reader getCharacterStream() throws SQLException;
84
85   /**
86    * This method returns a byte stream that reads the contents of the
87    * CLOB as a series of ASCII bytes.
88    *
89    * @return A stream to read the CLOB's contents.
90    * @exception SQLException If an error occurs.
91    * @since 1.2
92    */
93   InputStream getAsciiStream() throws SQLException;
94
95   /**
96    * This method returns the index into the CLOB of the first occurrence of
97    * the specified character pattern (supplied by the caller as a
98    * <code>String</code>).  The search begins at the specified index.
99    *
100    * @param searchstr The character pattern to search for, passed as a
101    *        <code>String</code>.
102    * @param start.  The index into the CLOB to start search (indexes start
103    *        at 1).
104    * @return The index at which the pattern was found (indexes start at 1),
105    *         or -1 if the pattern was not found.
106    * @exception SQLException If an error occurs.
107    * @since 1.2
108    */
109   long position(String searchstr, long start) throws SQLException;
110
111   /**
112    * This method returns the index into the CLOB of the first occurrence of
113    * the specified character pattern (supplied by the caller as a
114    * <code>Clob</code>).  The search begins at the specified index.
115    *
116    * @param searchstr The character pattern to search for, passed as a
117    *        <code>Clob</code>.
118    * @param start.  The index into the CLOB to start search (indexes start
119    *        at 1).
120    * @return The index at which the pattern was found (indexes start at 1),
121    *         or -1 if the pattern was not found.
122    * @exception SQLException If an error occurs.
123    * @since 1.2
124    */
125   long position(Clob searchstr, long start) throws SQLException;
126
127   /**
128    * @since 1.4
129    */
130   int setString(long pos, String str) throws SQLException;
131
132   /**
133    * @since 1.4
134    */
135   int setString(long pos, String str, int offset, int len)
136     throws SQLException;
137
138   /**
139    * @since 1.4
140    */
141   OutputStream setAsciiStream(long pos) throws SQLException;
142
143   /**
144    * @since 1.4
145    */
146   Writer setCharacterStream(long pos) throws SQLException;
147
148   /**
149    * @since 1.4
150    */
151   void truncate(long len) throws SQLException;
152 }