OSDN Git Service

a3298febbfa412adbc6e4e087de838b9248d751a
[pf3gnuchains/gcc-fork.git] / libjava / java / sql / Clob.java
1 /* Clob.java -- Access Character Large OBjects
2    Copyright (C) 1999, 2000 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 As a special exception, if you link this library with other files to
22 produce an executable, this library does not by itself cause the
23 resulting executable to be covered by the GNU General Public License.
24 This exception does not however invalidate any other reasons why the
25 executable file might be covered by the GNU General Public License. */
26
27
28 package java.sql;
29
30 import java.io.InputStream;
31 import java.io.Reader;
32
33 /**
34   * This interface contains methods for accessing a SQL CLOB (Character
35   * Large OBject) type.
36   *
37   * @author Aaron M. Renn (arenn@urbanophile.com)
38   */
39 public interface Clob
40 {
41
42 /**
43   * This method returns the number of characters in the CLOB.
44   *
45   * @return The number of characters in the CLOB.
46   *
47   * @exception SQLException If an error occurs.
48   */
49 public abstract long
50 length() throws SQLException;
51
52 /*************************************************************************/
53
54 /**
55   * This method returns the specified portion of the CLOB as a 
56   * <code>String</code>. 
57   *
58   * @param offset The index into the CLOB (index values start at 1) to 
59   * start returning characters from.
60   * @param length The requested number of characters to return.
61   *
62   * @return The requested CLOB section, as a <code>String</code>.
63   *
64   * @exception SQLException If an error occurs.
65   */
66 public abstract String
67 getSubString(long offset, int length) throws SQLException;
68
69 /*************************************************************************/
70
71 /**
72   * This method returns a byte stream that reads the contents of the
73   * CLOB as a series of ASCII bytes.
74   *
75   * @return A stream to read the CLOB's contents.
76   *
77   * @exception SQLException If an error occurs.
78   */
79 public abstract InputStream
80 getAsciiStream() throws SQLException;
81
82 /*************************************************************************/
83
84 /**
85   * This method returns a character stream that reads the contents of the
86   * CLOB.
87   *
88   * @return A character stream to read the CLOB's contents.
89   *
90   * @exception SQLException If an error occurs.
91   */
92 public abstract Reader
93 getCharacterStream() throws SQLException;
94
95 /*************************************************************************/
96
97 /**
98   * This method returns the index into the CLOB of the first occurrence of
99   * the specified character pattern (supplied by the caller as a
100   * <code>String</code>).  The search begins at the specified index.
101   *
102   * @param pattern The character pattern to search for, passed as a
103   * <code>String</code>.
104   * @param offset.  The index into the CLOB to start search (indexes start
105   * at 1).
106   *
107   * @return The index at which the pattern was found (indexes start at 1),
108   * or -1 if the pattern was not found.
109   *
110   * @exception SQLException If an error occurs.
111   */
112 public abstract long
113 position(String pattern, long offset) throws SQLException;
114
115 /*************************************************************************/
116
117 /**
118   * This method returns the index into the CLOB of the first occurrence of
119   * the specified character pattern (supplied by the caller as a
120   * <code>Clob</code>).  The search begins at the specified index.
121   *
122   * @param pattern The character pattern to search for, passed as a
123   * <code>Clob</code>.
124   * @param offset.  The index into the CLOB to start search (indexes start
125   * at 1).
126   *
127   * @return The index at which the pattern was found (indexes start at 1),
128   * or -1 if the pattern was not found.
129   *
130   * @exception SQLException If an error occurs.
131   */
132 public abstract long
133 position(Clob pattern, long offset) throws SQLException;
134
135 } // interface Clob
136