001/* SQLInput.java -- Read SQL values from a stream
002   Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
003
004This file is part of GNU Classpath.
005
006GNU Classpath is free software; you can redistribute it and/or modify
007it under the terms of the GNU General Public License as published by
008the Free Software Foundation; either version 2, or (at your option)
009any later version.
010
011GNU Classpath is distributed in the hope that it will be useful, but
012WITHOUT ANY WARRANTY; without even the implied warranty of
013MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014General Public License for more details.
015
016You should have received a copy of the GNU General Public License
017along with GNU Classpath; see the file COPYING.  If not, write to the
018Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
01902110-1301 USA.
020
021Linking this library statically or dynamically with other modules is
022making a combined work based on this library.  Thus, the terms and
023conditions of the GNU General Public License cover the whole
024combination.
025
026As a special exception, the copyright holders of this library give you
027permission to link this library with independent modules to produce an
028executable, regardless of the license terms of these independent
029modules, and to copy and distribute the resulting executable under
030terms of your choice, provided that you also meet, for each linked
031independent module, the terms and conditions of the license of that
032module.  An independent module is a module which is not derived from
033or based on this library.  If you modify this library, you may extend
034this exception to your version of the library, but you are not
035obligated to do so.  If you do not wish to do so, delete this
036exception statement from your version. */
037
038
039package java.sql;
040
041import java.io.InputStream;
042import java.io.Reader;
043import java.math.BigDecimal;
044import java.net.URL;
045
046/**
047 * This interface provides methods for reading values from a stream
048 * that is connected to a SQL structured or distinct type.  It is used
049 * for custom mapping of user defined data types.
050 *
051 * @author Aaron M. Renn (arenn@urbanophile.com)
052 */
053public interface SQLInput
054{
055  /**
056   * This method reads the next item from the stream a Java
057   * <code>String</code>.
058   *
059   * @return The value read from the stream as a <code>String</code>.
060   * @exception SQLException If an error occurs.
061   */
062  String readString() throws SQLException;
063
064  /**
065   * This method reads the next item from the stream a Java
066   * <code>boolean</code>.
067   *
068   * @return The value read from the stream as a <code>boolean</code>.
069   * @exception SQLException If an error occurs.
070   */
071  boolean readBoolean() throws SQLException;
072
073  /**
074   * This method reads the next item from the stream a Java
075   * <code>byte</code>.
076   *
077   * @return The value read from the stream as a <code>byte</code>.
078   * @exception SQLException If an error occurs.
079   */
080  byte readByte() throws SQLException;
081
082  /**
083   * This method reads the next item from the stream a Java
084   * <code>short</code>.
085   *
086   * @return The value read from the stream as a <code>short</code>.
087   * @exception SQLException If an error occurs.
088   */
089  short readShort() throws SQLException;
090
091  /**
092   * This method reads the next item from the stream a Java
093   * <code>int</code>.
094   *
095   * @return The value read from the stream as an <code>int</code>.
096   * @exception SQLException If an error occurs.
097   */
098  int readInt() throws SQLException;
099
100  /**
101   * This method reads the next item from the stream a Java
102   * <code>long</code>.
103   *
104   * @return The value read from the stream as a <code>long</code>.
105   * @exception SQLException If an error occurs.
106   */
107  long readLong() throws SQLException;
108
109  /**
110   * This method reads the next item from the stream a Java
111   * <code>float</code>.
112   *
113   * @return The value read from the stream as a <code>float</code>.
114   * @exception SQLException If an error occurs.
115   */
116  float readFloat() throws SQLException;
117
118  /**
119   * This method reads the next item from the stream a Java
120   * <code>double</code>.
121   *
122   * @return The value read from the stream as a <code>double</code>.
123   * @exception SQLException If an error occurs.
124   */
125  double readDouble() throws SQLException;
126
127  /**
128   * This method reads the next item from the stream a Java
129   * <code>BigDecimal</code>.
130   *
131   * @return The value read from the stream as a <code>BigDecimal</code>.
132   * @exception SQLException If an error occurs.
133   */
134  BigDecimal readBigDecimal() throws SQLException;
135
136  /**
137   * This method reads the next item from the stream a Java
138   * byte array
139   *
140   * @return The value read from the stream as a byte array.
141   * @exception SQLException If an error occurs.
142   */
143  byte[] readBytes() throws SQLException;
144
145  /**
146   * This method reads the next item from the stream a Java
147   * <code>java.sql.Date</code>.
148   *
149   * @return The value read from the stream as a <code>java.sql.Date</code>.
150   * @exception SQLException If an error occurs.
151   */
152  Date readDate() throws SQLException;
153
154  /**
155   * This method reads the next item from the stream a Java
156   * <code>java.sql.Time</code>.
157   *
158   * @return The value read from the stream as a <code>java.sql.Time</code>.
159   * @exception SQLException If an error occurs.
160   */
161  Time readTime() throws SQLException;
162
163  /**
164   * This method reads the next item from the stream a Java
165   * <code>java.sql.Timestamp</code>.
166   *
167   * @return The value read from the stream as a <code>java.sql.Timestamp</code>.
168   * @exception SQLException If an error occurs.
169   */
170  Timestamp readTimestamp() throws SQLException;
171
172  /**
173   * This method reads the next item from the stream a character
174   * <code>Reader</code>.
175   *
176   * @return The value read from the stream as a <code>Reader</code>.
177   * @exception SQLException If an error occurs.
178   */
179  Reader readCharacterStream() throws SQLException;
180
181  /**
182   * This method reads the next item from the stream a ASCII text
183   * <code>InputStream</code>.
184   *
185   * @return The value read from the stream as an <code>InputStream</code>.
186   * @exception SQLException If an error occurs.
187   */
188  InputStream readAsciiStream() throws SQLException;
189
190  /**
191   * This method reads the next item from the stream a binary
192   * <code>InputStream</code>.
193   *
194   * @return The value read from the stream as an <code>InputStream</code>.
195   * @exception SQLException If an error occurs.
196   */
197  InputStream readBinaryStream() throws SQLException;
198
199  /**
200   * This method reads the next item from the stream a Java
201   * <code>Object</code>.
202   *
203   * @return The value read from the stream as an <code>Object</code>.
204   * @exception SQLException If an error occurs.
205   */
206  Object readObject() throws SQLException;
207
208  /**
209   * This method reads the next item from the stream a Java SQL
210   * <code>Ref</code>.
211   *
212   * @return The value read from the stream as an <code>Ref</code>.
213   * @exception SQLException If an error occurs.
214   */
215  Ref readRef() throws SQLException;
216
217  /**
218   * This method reads the next item from the stream a Java SQL
219   * <code>Blob</code>.
220   *
221   * @return The value read from the stream as a <code>Blob</code>.
222   * @exception SQLException If an error occurs.
223   */
224  Blob readBlob() throws SQLException;
225
226  /**
227   * This method reads the next item from the stream a Java SQL
228   * <code>Clob</code>.
229   *
230   * @return The value read from the stream as a <code>Clob</code>.
231   * @exception SQLException If an error occurs.
232   */
233  Clob readClob() throws SQLException;
234
235  /**
236   * This method reads the next item from the stream a Java SQL
237   * <code>Array</code>.
238   *
239   * @return The value read from the stream as an <code>Array</code>.
240   * @exception SQLException If an error occurs.
241   */
242  Array readArray() throws SQLException;
243
244  /**
245   * This method tests whether or not the last value read was a SQL
246   * NULL value.
247   *
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.
251   */
252  boolean wasNull() throws SQLException;
253
254  /**
255   * @since 1.4
256   */
257  URL readURL() throws SQLException;
258}