Top Description Methods
java.sql

public Interface SQLInput


An input stream that contains a stream of values representing an instance of an SQL structured type or an SQL distinct type. This interface, used only for custom mapping, is used by the driver behind the scenes, and a programmer never directly invokes SQLInput methods. The reader methods (readLong, readBytes, and so on) provide a way for an implementation of the SQLData interface to read the values in an SQLInput object. And as described in SQLData, calls to reader methods must be made in the order that their corresponding attributes appear in the SQL definition of the type. The method wasNull is used to determine whether the last value read was SQL NULL.

When the method getObject is called with an object of a class implementing the interface SQLData, the JDBC driver calls the method SQLData.getSQLType to determine the SQL type of the user-defined type (UDT) being custom mapped. The driver creates an instance of SQLInput, populating it with the attributes of the UDT. The driver then passes the input stream to the method SQLData.readSQL, which in turn calls the SQLInput reader methods in its implementation for reading the attributes from the input stream.

Since
1.2

Method Summary

Modifier and TypeMethod and Description
public Array

Returns:

an Array object representing data of the SQL ARRAY value at the head of the stream; null if the value read is SQL NULL
readArray
()

Reads an SQL ARRAY value from the stream and returns it as an Array object in the Java programming language.

public InputStream

Returns:

the attribute; if the value is SQL NULL, returns null
readAsciiStream
()

Reads the next attribute in the stream and returns it as a stream of ASCII characters.

public BigDecimal

Returns:

the attribute; if the value is SQL NULL, returns null
readBigDecimal
()

Reads the next attribute in the stream and returns it as a java.math.BigDecimal object in the Java programming language.

public InputStream

Returns:

the attribute; if the value is SQL NULL, returns null
readBinaryStream
()

Reads the next attribute in the stream and returns it as a stream of uninterpreted bytes.

public Blob

Returns:

a Blob object representing data of the SQL BLOB value at the head of the stream; null if the value read is SQL NULL
readBlob
()

Reads an SQL BLOB value from the stream and returns it as a Blob object in the Java programming language.

public boolean

Returns:

the attribute; if the value is SQL NULL, returns false
readBoolean
()

Reads the next attribute in the stream and returns it as a boolean in the Java programming language.

public byte

Returns:

the attribute; if the value is SQL NULL, returns 0
readByte
()

Reads the next attribute in the stream and returns it as a byte in the Java programming language.

public byte[]

Returns:

the attribute; if the value is SQL NULL, returns null
readBytes
()

Reads the next attribute in the stream and returns it as an array of bytes in the Java programming language.

public Reader

Returns:

the attribute; if the value is SQL NULL, returns null
readCharacterStream
()

Reads the next attribute in the stream and returns it as a stream of Unicode characters.

public Clob

Returns:

a Clob object representing data of the SQL CLOB value at the head of the stream; null if the value read is SQL NULL
readClob
()

Reads an SQL CLOB value from the stream and returns it as a Clob object in the Java programming language.

public Date

Returns:

the attribute; if the value is SQL NULL, returns null
readDate
()

Reads the next attribute in the stream and returns it as a java.sql.Date object.

public double

Returns:

the attribute; if the value is SQL NULL, returns 0
readDouble
()

Reads the next attribute in the stream and returns it as a double in the Java programming language.

public float

Returns:

the attribute; if the value is SQL NULL, returns 0
readFloat
()

Reads the next attribute in the stream and returns it as a float in the Java programming language.

public int

Returns:

the attribute; if the value is SQL NULL, returns 0
readInt
()

Reads the next attribute in the stream and returns it as an int in the Java programming language.

public long

Returns:

the attribute; if the value is SQL NULL, returns 0
readLong
()

Reads the next attribute in the stream and returns it as a long in the Java programming language.

public NClob

Returns:

a NClob object representing data of the SQL NCLOB value at the head of the stream; null if the value read is SQL NULL
readNClob
()

Reads an SQL NCLOB value from the stream and returns it as a NClob object in the Java programming language.

public String

Returns:

the attribute; if the value is SQL NULL, returns null
readNString
()

Reads the next attribute in the stream and returns it as a String in the Java programming language.

public Object

Returns:

the datum at the head of the stream as an Object in the Java programming language;null if the datum is SQL NULL
readObject
()

Reads the datum at the head of the stream and returns it as an Object in the Java programming language.

public default <
the type of the class modeled by this Class object
T
>
T

Returns:

the attribute at the head of the stream as an Object in the Java programming language;null if the attribute is SQL NULL
readObject
(Class<T>
Class representing the Java data type to convert the attribute to.
type
)

Reads the next attribute in the stream and returns it as an Object in the Java programming language.

public Ref

Returns:

a Ref object representing the SQL REF value at the head of the stream; null if the value read is SQL NULL
readRef
()

Reads an SQL REF value from the stream and returns it as a Ref object in the Java programming language.

public RowId

Returns:

a RowId object representing data of the SQL ROWID value at the head of the stream; null if the value read is SQL NULL
readRowId
()

Reads an SQL ROWID value from the stream and returns it as a RowId object in the Java programming language.

public short

Returns:

the attribute; if the value is SQL NULL, returns 0
readShort
()

Reads the next attribute in the stream and returns it as a short in the Java programming language.

public SQLXML

Returns:

a SQLXML object representing data of the SQL XML value at the head of the stream; null if the value read is SQL NULL
readSQLXML
()

Reads an SQL XML value from the stream and returns it as a SQLXML object in the Java programming language.

public String

Returns:

the attribute; if the value is SQL NULL, returns null
readString
()

Reads the next attribute in the stream and returns it as a String in the Java programming language.

public Time

Returns:

the attribute; if the value is SQL NULL, returns null
readTime
()

Reads the next attribute in the stream and returns it as a java.sql.Time object.

public Timestamp

Returns:

the attribute; if the value is SQL NULL, returns null
readTimestamp
()

Reads the next attribute in the stream and returns it as a java.sql.Timestamp object.

public URL

Returns:

a java.net.URL object.
readURL
()

Reads an SQL DATALINK value from the stream and returns it as a java.net.URL object in the Java programming language.

public boolean

Returns:

true if the most recently read SQL value was SQL NULL; false otherwise
wasNull
()

Retrieves whether the last value read was SQL NULL.

Method Detail

readArrayback to summary
public Array readArray() throws SQLException

Reads an SQL ARRAY value from the stream and returns it as an Array object in the Java programming language.

Returns:Array

an Array object representing data of the SQL ARRAY value at the head of the stream; null if the value read is SQL NULL

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readAsciiStreamback to summary
public InputStream readAsciiStream() throws SQLException

Reads the next attribute in the stream and returns it as a stream of ASCII characters.

Returns:InputStream

the attribute; if the value is SQL NULL, returns null

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readBigDecimalback to summary
public BigDecimal readBigDecimal() throws SQLException

Reads the next attribute in the stream and returns it as a java.math.BigDecimal object in the Java programming language.

Returns:BigDecimal

the attribute; if the value is SQL NULL, returns null

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readBinaryStreamback to summary
public InputStream readBinaryStream() throws SQLException

Reads the next attribute in the stream and returns it as a stream of uninterpreted bytes.

Returns:InputStream

the attribute; if the value is SQL NULL, returns null

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readBlobback to summary
public Blob readBlob() throws SQLException

Reads an SQL BLOB value from the stream and returns it as a Blob object in the Java programming language.

Returns:Blob

a Blob object representing data of the SQL BLOB value at the head of the stream; null if the value read is SQL NULL

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readBooleanback to summary
public boolean readBoolean() throws SQLException

Reads the next attribute in the stream and returns it as a boolean in the Java programming language.

Returns:boolean

the attribute; if the value is SQL NULL, returns false

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readByteback to summary
public byte readByte() throws SQLException

Reads the next attribute in the stream and returns it as a byte in the Java programming language.

Returns:byte

the attribute; if the value is SQL NULL, returns 0

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readBytesback to summary
public byte[] readBytes() throws SQLException

Reads the next attribute in the stream and returns it as an array of bytes in the Java programming language.

Returns:byte[]

the attribute; if the value is SQL NULL, returns null

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readCharacterStreamback to summary
public Reader readCharacterStream() throws SQLException

Reads the next attribute in the stream and returns it as a stream of Unicode characters.

Returns:Reader

the attribute; if the value is SQL NULL, returns null

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readClobback to summary
public Clob readClob() throws SQLException

Reads an SQL CLOB value from the stream and returns it as a Clob object in the Java programming language.

Returns:Clob

a Clob object representing data of the SQL CLOB value at the head of the stream; null if the value read is SQL NULL

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readDateback to summary
public Date readDate() throws SQLException

Reads the next attribute in the stream and returns it as a java.sql.Date object.

Returns:Date

the attribute; if the value is SQL NULL, returns null

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readDoubleback to summary
public double readDouble() throws SQLException

Reads the next attribute in the stream and returns it as a double in the Java programming language.

Returns:double

the attribute; if the value is SQL NULL, returns 0

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readFloatback to summary
public float readFloat() throws SQLException

Reads the next attribute in the stream and returns it as a float in the Java programming language.

Returns:float

the attribute; if the value is SQL NULL, returns 0

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readIntback to summary
public int readInt() throws SQLException

Reads the next attribute in the stream and returns it as an int in the Java programming language.

Returns:int

the attribute; if the value is SQL NULL, returns 0

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readLongback to summary
public long readLong() throws SQLException

Reads the next attribute in the stream and returns it as a long in the Java programming language.

Returns:long

the attribute; if the value is SQL NULL, returns 0

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readNClobback to summary
public NClob readNClob() throws SQLException

Reads an SQL NCLOB value from the stream and returns it as a NClob object in the Java programming language.

Returns:NClob

a NClob object representing data of the SQL NCLOB value at the head of the stream; null if the value read is SQL NULL

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.6
readNStringback to summary
public String readNString() throws SQLException

Reads the next attribute in the stream and returns it as a String in the Java programming language. It is intended for use when accessing NCHAR,NVARCHAR and LONGNVARCHAR columns.

Returns:String

the attribute; if the value is SQL NULL, returns null

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.6
readObjectback to summary
public Object readObject() throws SQLException

Reads the datum at the head of the stream and returns it as an Object in the Java programming language. The actual type of the object returned is determined by the default type mapping, and any customizations present in this stream's type map.

A type map is registered with the stream by the JDBC driver before the stream is passed to the application.

When the datum at the head of the stream is an SQL NULL, the method returns null. If the datum is an SQL structured or distinct type, it determines the SQL type of the datum at the head of the stream. If the stream's type map has an entry for that SQL type, the driver constructs an object of the appropriate class and calls the method SQLData.readSQL on that object, which reads additional data from the stream, using the protocol described for that method.

Returns:Object

the datum at the head of the stream as an Object in the Java programming language;null if the datum is SQL NULL

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readObjectback to summary
public default <T> T readObject(Class<T> type) throws SQLException

Reads the next attribute in the stream and returns it as an Object in the Java programming language. The actual type of the object returned is determined by the specified Java data type, and any customizations present in this stream's type map.

A type map is registered with the stream by the JDBC driver before the stream is passed to the application.

When the attribute at the head of the stream is an SQL NULL the method returns null. If the attribute is an SQL structured or distinct type, it determines the SQL type of the attribute at the head of the stream. If the stream's type map has an entry for that SQL type, the driver constructs an object of the appropriate class and calls the method SQLData.readSQL on that object, which reads additional data from the stream, using the protocol described for that method.

The default implementation will throw SQLFeatureNotSupportedException

Parameters
<T>
the type of the class modeled by this Class object
type:Class<T>

Class representing the Java data type to convert the attribute to.

Returns:T

the attribute at the head of the stream as an Object in the Java programming language;null if the attribute is SQL NULL

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.8
readRefback to summary
public Ref readRef() throws SQLException

Reads an SQL REF value from the stream and returns it as a Ref object in the Java programming language.

Returns:Ref

a Ref object representing the SQL REF value at the head of the stream; null if the value read is SQL NULL

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readRowIdback to summary
public RowId readRowId() throws SQLException

Reads an SQL ROWID value from the stream and returns it as a RowId object in the Java programming language.

Returns:RowId

a RowId object representing data of the SQL ROWID value at the head of the stream; null if the value read is SQL NULL

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.6
readShortback to summary
public short readShort() throws SQLException

Reads the next attribute in the stream and returns it as a short in the Java programming language.

Returns:short

the attribute; if the value is SQL NULL, returns 0

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readSQLXMLback to summary
public SQLXML readSQLXML() throws SQLException

Reads an SQL XML value from the stream and returns it as a SQLXML object in the Java programming language.

Returns:SQLXML

a SQLXML object representing data of the SQL XML value at the head of the stream; null if the value read is SQL NULL

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.6
readStringback to summary
public String readString() throws SQLException

Reads the next attribute in the stream and returns it as a String in the Java programming language.

Returns:String

the attribute; if the value is SQL NULL, returns null

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readTimeback to summary
public Time readTime() throws SQLException

Reads the next attribute in the stream and returns it as a java.sql.Time object.

Returns:Time

the attribute; if the value is SQL NULL, returns null

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readTimestampback to summary
public Timestamp readTimestamp() throws SQLException

Reads the next attribute in the stream and returns it as a java.sql.Timestamp object.

Returns:Timestamp

the attribute; if the value is SQL NULL, returns null

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2
readURLback to summary
public URL readURL() throws SQLException

Reads an SQL DATALINK value from the stream and returns it as a java.net.URL object in the Java programming language.

Returns:URL

a java.net.URL object.

Exceptions
SQLException:
if a database access error occurs, or if a URL is malformed
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.4
wasNullback to summary
public boolean wasNull() throws SQLException

Retrieves whether the last value read was SQL NULL.

Returns:boolean

true if the most recently read SQL value was SQL NULL; false otherwise

Exceptions
SQLException:
if a database access error occurs
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
1.2