Source for java.sql.SQLInput

   1: /* SQLInput.java -- Read SQL values from a stream
   2:    Copyright (C) 1999, 2000, 2002 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., 51 Franklin Street, Fifth Floor, Boston, MA
  19: 02110-1301 USA.
  20: 
  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
  24: combination.
  25: 
  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. */
  37: 
  38: 
  39: package java.sql;
  40: 
  41: import java.io.InputStream;
  42: import java.io.Reader;
  43: import java.math.BigDecimal;
  44: import java.net.URL;
  45: 
  46: /**
  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.
  50:  *
  51:  * @author Aaron M. Renn (arenn@urbanophile.com)
  52:  */
  53: public interface SQLInput 
  54: {
  55:   /**
  56:    * This method reads the next item from the stream a Java
  57:    * <code>String</code>.
  58:    *
  59:    * @return The value read from the stream as a <code>String</code>.
  60:    * @exception SQLException If an error occurs.
  61:    */
  62:   String readString() throws SQLException;
  63: 
  64:   /**
  65:    * This method reads the next item from the stream a Java
  66:    * <code>boolean</code>.
  67:    *
  68:    * @return The value read from the stream as a <code>boolean</code>.
  69:    * @exception SQLException If an error occurs.
  70:    */
  71:   boolean readBoolean() throws SQLException;
  72: 
  73:   /**
  74:    * This method reads the next item from the stream a Java
  75:    * <code>byte</code>.
  76:    *
  77:    * @return The value read from the stream as a <code>byte</code>.
  78:    * @exception SQLException If an error occurs.
  79:    */
  80:   byte readByte() throws SQLException;
  81: 
  82:   /**
  83:    * This method reads the next item from the stream a Java
  84:    * <code>short</code>.
  85:    *
  86:    * @return The value read from the stream as a <code>short</code>.
  87:    * @exception SQLException If an error occurs.
  88:    */
  89:   short readShort() throws SQLException;
  90: 
  91:   /**
  92:    * This method reads the next item from the stream a Java
  93:    * <code>int</code>.
  94:    *
  95:    * @return The value read from the stream as an <code>int</code>.
  96:    * @exception SQLException If an error occurs.
  97:    */
  98:   int readInt() throws SQLException;
  99: 
 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: }