1 /* SQLInput.java -- Read SQL values from a stream
2 Copyright (C) 1999, 2000, 2002 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
;
47 * This interface provides methods for reading values from a stream
48 * that is connected to a SQL structured or distinct type. It is used
49 * for custom mapping of user defined data types.
51 * @author Aaron M. Renn (arenn@urbanophile.com)
53 public interface SQLInput
56 * This method reads the next item from the stream a Java
57 * <code>String</code>.
59 * @return The value read from the stream as a <code>String</code>.
60 * @exception SQLException If an error occurs.
62 String
readString() throws SQLException
;
65 * This method reads the next item from the stream a Java
66 * <code>boolean</code>.
68 * @return The value read from the stream as a <code>boolean</code>.
69 * @exception SQLException If an error occurs.
71 boolean readBoolean() throws SQLException
;
74 * This method reads the next item from the stream a Java
77 * @return The value read from the stream as a <code>byte</code>.
78 * @exception SQLException If an error occurs.
80 byte readByte() throws SQLException
;
83 * This method reads the next item from the stream a Java
86 * @return The value read from the stream as a <code>short</code>.
87 * @exception SQLException If an error occurs.
89 short readShort() throws SQLException
;
92 * This method reads the next item from the stream a Java
95 * @return The value read from the stream as an <code>int</code>.
96 * @exception SQLException If an error occurs.
98 int readInt() throws SQLException
;
101 * This method reads the next item from the stream a Java
104 * @return The value read from the stream as a <code>long</code>.
105 * @exception SQLException If an error occurs.
107 long readLong() throws SQLException
;
110 * This method reads the next item from the stream a Java
111 * <code>float</code>.
113 * @return The value read from the stream as a <code>float</code>.
114 * @exception SQLException If an error occurs.
116 float readFloat() throws SQLException
;
119 * This method reads the next item from the stream a Java
120 * <code>double</code>.
122 * @return The value read from the stream as a <code>double</code>.
123 * @exception SQLException If an error occurs.
125 double readDouble() throws SQLException
;
128 * This method reads the next item from the stream a Java
129 * <code>BigDecimal</code>.
131 * @return The value read from the stream as a <code>BigDecimal</code>.
132 * @exception SQLException If an error occurs.
134 BigDecimal
readBigDecimal() throws SQLException
;
137 * This method reads the next item from the stream a Java
140 * @return The value read from the stream as a byte array.
141 * @exception SQLException If an error occurs.
143 byte[] readBytes() throws SQLException
;
146 * This method reads the next item from the stream a Java
147 * <code>java.sql.Date</code>.
149 * @return The value read from the stream as a <code>java.sql.Date</code>.
150 * @exception SQLException If an error occurs.
152 Date
readDate() throws SQLException
;
155 * This method reads the next item from the stream a Java
156 * <code>java.sql.Time</code>.
158 * @return The value read from the stream as a <code>java.sql.Time</code>.
159 * @exception SQLException If an error occurs.
161 Time
readTime() throws SQLException
;
164 * This method reads the next item from the stream a Java
165 * <code>java.sql.Timestamp</code>.
167 * @return The value read from the stream as a <code>java.sql.Timestamp</code>.
168 * @exception SQLException If an error occurs.
170 Timestamp
readTimestamp() throws SQLException
;
173 * This method reads the next item from the stream a character
174 * <code>Reader</code>.
176 * @return The value read from the stream as a <code>Reader</code>.
177 * @exception SQLException If an error occurs.
179 Reader
readCharacterStream() throws SQLException
;
182 * This method reads the next item from the stream a ASCII text
183 * <code>InputStream</code>.
185 * @return The value read from the stream as an <code>InputStream</code>.
186 * @exception SQLException If an error occurs.
188 InputStream
readAsciiStream() throws SQLException
;
191 * This method reads the next item from the stream a binary
192 * <code>InputStream</code>.
194 * @return The value read from the stream as an <code>InputStream</code>.
195 * @exception SQLException If an error occurs.
197 InputStream
readBinaryStream() throws SQLException
;
200 * This method reads the next item from the stream a Java
201 * <code>Object</code>.
203 * @return The value read from the stream as an <code>Object</code>.
204 * @exception SQLException If an error occurs.
206 Object
readObject() throws SQLException
;
209 * This method reads the next item from the stream a Java SQL
212 * @return The value read from the stream as an <code>Ref</code>.
213 * @exception SQLException If an error occurs.
215 Ref
readRef() throws SQLException
;
218 * This method reads the next item from the stream a Java SQL
221 * @return The value read from the stream as a <code>Blob</code>.
222 * @exception SQLException If an error occurs.
224 Blob
readBlob() throws SQLException
;
227 * This method reads the next item from the stream a Java SQL
230 * @return The value read from the stream as a <code>Clob</code>.
231 * @exception SQLException If an error occurs.
233 Clob
readClob() throws SQLException
;
236 * This method reads the next item from the stream a Java SQL
237 * <code>Array</code>.
239 * @return The value read from the stream as an <code>Array</code>.
240 * @exception SQLException If an error occurs.
242 Array
readArray() throws SQLException
;
245 * This method tests whether or not the last value read was a SQL
248 * @return <code>true</code> if the last value read was a NULL,
249 * <code>false</code> otherwise.
250 * @exception SQLException If an error occurs.
252 boolean wasNull() throws SQLException
;
257 URL
readURL() throws SQLException
;