1 /* SQLInput.java -- Read SQL values from a stream
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
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)
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.
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
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
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. */
41 import java
.io
.InputStream
;
42 import java
.io
.Reader
;
43 import java
.math
.BigDecimal
;
46 * This interface provides methods for reading values from a stream
47 * that is connected to a SQL structured or distinct type. It is used
48 * for custom mapping of user defined data types.
50 * @author Aaron M. Renn (arenn@urbanophile.com)
52 public interface SQLInput
55 /*************************************************************************/
58 * This method reads the next item from the stream a Java
59 * <code>String</code>.
61 * @return The value read from the stream as a <code>String</code>.
63 * @exception SQLException If an error occurs.
65 public abstract String
66 readString() throws SQLException
;
68 /*************************************************************************/
71 * This method reads the next item from the stream a Java
72 * <code>boolean</code>.
74 * @return The value read from the stream as a <code>boolean</code>.
76 * @exception SQLException If an error occurs.
78 public abstract boolean
79 readBoolean() throws SQLException
;
81 /*************************************************************************/
84 * This method reads the next item from the stream a Java
87 * @return The value read from the stream as a <code>byte</code>.
89 * @exception SQLException If an error occurs.
92 readByte() throws SQLException
;
94 /*************************************************************************/
97 * This method reads the next item from the stream a Java
100 * @return The value read from the stream as a <code>short</code>.
102 * @exception SQLException If an error occurs.
104 public abstract short
105 readShort() throws SQLException
;
107 /*************************************************************************/
110 * This method reads the next item from the stream a Java
113 * @return The value read from the stream as an <code>int</code>.
115 * @exception SQLException If an error occurs.
118 readInt() throws SQLException
;
120 /*************************************************************************/
123 * This method reads the next item from the stream a Java
126 * @return The value read from the stream as a <code>long</code>.
128 * @exception SQLException If an error occurs.
131 readLong() throws SQLException
;
133 /*************************************************************************/
136 * This method reads the next item from the stream a Java
137 * <code>float</code>.
139 * @return The value read from the stream as a <code>float</code>.
141 * @exception SQLException If an error occurs.
143 public abstract float
144 readFloat() throws SQLException
;
146 /*************************************************************************/
149 * This method reads the next item from the stream a Java
150 * <code>double</code>.
152 * @return The value read from the stream as a <code>double</code>.
154 * @exception SQLException If an error occurs.
156 public abstract double
157 readDouble() throws SQLException
;
159 /*************************************************************************/
162 * This method reads the next item from the stream a Java
163 * <code>BigDecimal</code>.
165 * @return The value read from the stream as a <code>BigDecimal</code>.
167 * @exception SQLException If an error occurs.
169 public abstract BigDecimal
170 readBigDecimal() throws SQLException
;
172 /*************************************************************************/
175 * This method reads the next item from the stream a Java
178 * @return The value read from the stream as a byte array.
180 * @exception SQLException If an error occurs.
182 public abstract byte[]
183 readBytes() throws SQLException
;
185 /*************************************************************************/
188 * This method reads the next item from the stream a Java
189 * <code>java.sql.Date</code>.
191 * @return The value read from the stream as a <code>java.sql.Date</code>.
193 * @exception SQLException If an error occurs.
195 public abstract java
.sql
.Date
196 readDate() throws SQLException
;
198 /*************************************************************************/
201 * This method reads the next item from the stream a Java
202 * <code>java.sql.Time</code>.
204 * @return The value read from the stream as a <code>java.sql.Time</code>.
206 * @exception SQLException If an error occurs.
208 public abstract java
.sql
.Time
209 readTime() throws SQLException
;
211 /*************************************************************************/
214 * This method reads the next item from the stream a Java
215 * <code>java.sql.Timestamp</code>.
217 * @return The value read from the stream as a <code>java.sql.Timestamp</code>.
219 * @exception SQLException If an error occurs.
221 public abstract java
.sql
.Timestamp
222 readTimestamp() throws SQLException
;
224 /*************************************************************************/
227 * This method reads the next item from the stream a ASCII text
228 * <code>InputStream</code>.
230 * @return The value read from the stream as an <code>InputStream</code>.
232 * @exception SQLException If an error occurs.
234 public abstract InputStream
235 readAsciiStream() throws SQLException
;
237 /*************************************************************************/
240 * This method reads the next item from the stream a binary
241 * <code>InputStream</code>.
243 * @return The value read from the stream as an <code>InputStream</code>.
245 * @exception SQLException If an error occurs.
247 public abstract InputStream
248 readBinaryStream() throws SQLException
;
250 /*************************************************************************/
253 * This method reads the next item from the stream a character
254 * <code>Reader</code>.
256 * @return The value read from the stream as a <code>Reader</code>.
258 * @exception SQLException If an error occurs.
260 public abstract Reader
261 readCharacterStream() throws SQLException
;
263 /*************************************************************************/
266 * This method reads the next item from the stream a Java
267 * <code>Object</code>.
269 * @return The value read from the stream as an <code>Object</code>.
271 * @exception SQLException If an error occurs.
273 public abstract Object
274 readObject() throws SQLException
;
276 /*************************************************************************/
279 * This method reads the next item from the stream a Java SQL
282 * @return The value read from the stream as an <code>Ref</code>.
284 * @exception SQLException If an error occurs.
287 readRef() throws SQLException
;
289 /*************************************************************************/
292 * This method reads the next item from the stream a Java SQL
295 * @return The value read from the stream as a <code>Blob</code>.
297 * @exception SQLException If an error occurs.
300 readBlob() throws SQLException
;
302 /*************************************************************************/
305 * This method reads the next item from the stream a Java SQL
308 * @return The value read from the stream as a <code>Clob</code>.
310 * @exception SQLException If an error occurs.
313 readClob() throws SQLException
;
315 /*************************************************************************/
318 * This method reads the next item from the stream a Java SQL
319 * <code>Array</code>.
321 * @return The value read from the stream as an <code>Array</code>.
323 * @exception SQLException If an error occurs.
325 public abstract Array
326 readArray() throws SQLException
;
328 /*************************************************************************/
331 * This method tests whether or not the last value read was a SQL
334 * @return <code>true</code> if the last value read was a NULL,
335 * <code>false</code> otherwise.
337 * @exception SQLException If an error occurs.
339 public abstract boolean
340 wasNull() throws SQLException
;
342 } // interface SQLInput