1 |
/* Clob.java -- Access Character Large OBjects |
/* Clob.java -- Access Character Large OBjects |
2 |
Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
35 |
obligated to do so. If you do not wish to do so, delete this |
obligated to do so. If you do not wish to do so, delete this |
36 |
exception statement from your version. */ |
exception statement from your version. */ |
37 |
|
|
|
|
|
38 |
package java.sql; |
package java.sql; |
39 |
|
|
40 |
import java.io.InputStream; |
import java.io.InputStream; |
41 |
|
import java.io.OutputStream; |
42 |
import java.io.Reader; |
import java.io.Reader; |
43 |
|
import java.io.Writer; |
44 |
|
|
45 |
/** |
/** |
46 |
* This interface contains methods for accessing a SQL CLOB (Character |
* This interface contains methods for accessing a SQL CLOB (Character |
47 |
* Large OBject) type. |
* Large OBject) type. |
48 |
* |
* |
49 |
* @author Aaron M. Renn (arenn@urbanophile.com) |
* @author Aaron M. Renn (arenn@urbanophile.com) |
50 |
*/ |
*/ |
51 |
public interface Clob |
public interface Clob |
52 |
{ |
{ |
53 |
|
/** |
|
/** |
|
54 |
* This method returns the number of characters in the CLOB. |
* This method returns the number of characters in the CLOB. |
55 |
* |
* |
56 |
* @return The number of characters in the CLOB. |
* @return The number of characters in the CLOB. |
|
* |
|
57 |
* @exception SQLException If an error occurs. |
* @exception SQLException If an error occurs. |
58 |
|
* @since 1.2 |
59 |
*/ |
*/ |
60 |
public abstract long |
public long length() throws SQLException; |
|
length() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method returns the specified portion of the CLOB as a |
|
|
* <code>String</code>. |
|
|
* |
|
|
* @param offset The index into the CLOB (index values start at 1) to |
|
|
* start returning characters from. |
|
|
* @param length The requested number of characters to return. |
|
|
* |
|
|
* @return The requested CLOB section, as a <code>String</code>. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract String |
|
|
getSubString(long offset, int length) throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method returns a byte stream that reads the contents of the |
|
|
* CLOB as a series of ASCII bytes. |
|
|
* |
|
|
* @return A stream to read the CLOB's contents. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract InputStream |
|
|
getAsciiStream() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method returns a character stream that reads the contents of the |
|
|
* CLOB. |
|
|
* |
|
|
* @return A character stream to read the CLOB's contents. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract Reader |
|
|
getCharacterStream() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method returns the index into the CLOB of the first occurrence of |
|
|
* the specified character pattern (supplied by the caller as a |
|
|
* <code>String</code>). The search begins at the specified index. |
|
|
* |
|
|
* @param pattern The character pattern to search for, passed as a |
|
|
* <code>String</code>. |
|
|
* @param offset. The index into the CLOB to start search (indexes start |
|
|
* at 1). |
|
|
* |
|
|
* @return The index at which the pattern was found (indexes start at 1), |
|
|
* or -1 if the pattern was not found. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract long |
|
|
position(String pattern, long offset) throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method returns the index into the CLOB of the first occurrence of |
|
|
* the specified character pattern (supplied by the caller as a |
|
|
* <code>Clob</code>). The search begins at the specified index. |
|
|
* |
|
|
* @param pattern The character pattern to search for, passed as a |
|
|
* <code>Clob</code>. |
|
|
* @param offset. The index into the CLOB to start search (indexes start |
|
|
* at 1). |
|
|
* |
|
|
* @return The index at which the pattern was found (indexes start at 1), |
|
|
* or -1 if the pattern was not found. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract long |
|
|
position(Clob pattern, long offset) throws SQLException; |
|
|
|
|
|
} // interface Clob |
|
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 |
|
public 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 |
|
public 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 |
|
public 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 |
|
public 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 |
|
public long position(Clob searchstr, long start) throws SQLException; |
126 |
|
|
127 |
|
/** |
128 |
|
* @since 1.4 |
129 |
|
*/ |
130 |
|
public int setString(long pos, String str) throws SQLException; |
131 |
|
|
132 |
|
/** |
133 |
|
* @since 1.4 |
134 |
|
*/ |
135 |
|
public int setString(long pos, String str, int offset, int len) |
136 |
|
throws SQLException; |
137 |
|
|
138 |
|
/** |
139 |
|
* @since 1.4 |
140 |
|
*/ |
141 |
|
public OutputStream setAsciiStream(long pos) throws SQLException; |
142 |
|
|
143 |
|
/** |
144 |
|
* @since 1.4 |
145 |
|
*/ |
146 |
|
public Writer setCharacterStream(long pos) throws SQLException; |
147 |
|
|
148 |
|
/** |
149 |
|
* @since 1.4 |
150 |
|
*/ |
151 |
|
public void truncate(long len) throws SQLException; |
152 |
|
} |