- java.lang.Object
- 
- javax.sql.rowset.serial.SQLInputImpl
 
- 
- All Implemented Interfaces:
- SQLInput
 
 public class SQLInputImpl extends Object implements SQLInput An input stream used for custom mapping user-defined types (UDTs). AnSQLInputImplobject is an input stream that contains a stream of values that are the attributes of a UDT.This class is used by the driver behind the scenes when the method getObjectis called on an SQL structured or distinct type that has a custom mapping; a programmer never invokesSQLInputImplmethods directly. They are provided here as a convenience for those who writeRowSetimplementations.The SQLInputImplclass provides a set of reader methods analogous to theResultSetgetter methods. These methods make it possible to read the values in anSQLInputImplobject.The method wasNullis used to determine whether the the last value read was SQLNULL.When the method getObjectis called with an object of a class implementing the interfaceSQLData, the JDBC driver calls the methodSQLData.getSQLTypeto determine the SQL type of the UDT being custom mapped. The driver creates an instance ofSQLInputImpl, populating it with the attributes of the UDT. The driver then passes the input stream to the methodSQLData.readSQL, which in turn calls theSQLInputImplreader methods to read the attributes from the input stream.- Since:
- 1.5
- See Also:
- SQLData
 
- 
- 
Constructor SummaryConstructors Constructor Description SQLInputImpl(Object[] attributes, Map<String,Class<?>> map)Creates anSQLInputImplobject initialized with the given array of attributes and the given type map.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description ArrayreadArray()Reads an SQLARRAYvalue from the stream and returns it as anArrayobject in the Java programming language.InputStreamreadAsciiStream()Returns the next attribute in thisSQLInputImplobject as a stream of ASCII characters.BigDecimalreadBigDecimal()Retrieves the next attribute in thisSQLInputImplobject as ajava.math.BigDecimal.InputStreamreadBinaryStream()Returns the next attribute in thisSQLInputImplobject as a stream of uninterpreted bytes.BlobreadBlob()Retrieves theBLOBvalue at the head of thisSQLInputImplobject as aBlobobject in the Java programming language.booleanreadBoolean()Retrieves the next attribute in thisSQLInputImplobject as abooleanin the Java programming language.bytereadByte()Retrieves the next attribute in thisSQLInputImplobject as abytein the Java programming language.byte[]readBytes()Retrieves the next attribute in thisSQLInputImplobject as an array of bytes.ReaderreadCharacterStream()Retrieves the next attribute in thisSQLInputImplobject as a stream of Unicode characters.ClobreadClob()Retrieves theCLOBvalue at the head of thisSQLInputImplobject as aClobobject in the Java programming language.DatereadDate()Retrieves the next attribute in thisSQLInputImplas ajava.sql.Dateobject.doublereadDouble()Retrieves the next attribute in thisSQLInputImplobject as adoublein the Java programming language.floatreadFloat()Retrieves the next attribute in thisSQLInputImplobject as afloatin the Java programming language.intreadInt()Retrieves the next attribute in thisSQLInputImplobject as anintin the Java programming language.longreadLong()Retrieves the next attribute in thisSQLInputImplobject as alongin the Java programming language.NClobreadNClob()Reads an SQLNCLOBvalue from the stream and returns it as aClobobject in the Java programming language.StringreadNString()Reads the next attribute in the stream and returns it as aStringin the Java programming language.ObjectreadObject()Retrieves the value at the head of thisSQLInputImplobject as anObjectin the Java programming language.RefreadRef()Retrieves the value at the head of thisSQLInputImplobject as aRefobject in the Java programming language.RowIdreadRowId()Reads an SQLROWIDvalue from the stream and returns it as aRowIdobject in the Java programming language.shortreadShort()Retrieves the next attribute in thisSQLInputImplobject as ashortin the Java programming language.SQLXMLreadSQLXML()Reads an SQLXMLvalue from the stream and returns it as aSQLXMLobject in the Java programming language.StringreadString()Retrieves the next attribute in thisSQLInputImplobject as aStringin the Java programming language.TimereadTime()Retrieves the next attribute in thisSQLInputImplobject as ajava.sql.Timeobject.TimestampreadTimestamp()Retrieves the next attribute in thisSQLInputImplobject as ajava.sql.Timestampobject.URLreadURL()Reads an SQLDATALINKvalue from the stream and returns it as anURLobject in the Java programming language.booleanwasNull()Ascertains whether the last value read from thisSQLInputImplobject wasnull.- 
Methods declared in class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods declared in interface java.sql.SQLInputreadObject
 
- 
 
- 
- 
- 
Constructor Detail- 
SQLInputImplpublic SQLInputImpl(Object[] attributes, Map<String,Class<?>> map) throws SQLException Creates anSQLInputImplobject initialized with the given array of attributes and the given type map. If any of the attributes is a UDT whose name is in an entry in the type map, the attribute will be mapped according to the correspondingSQLDataimplementation.- Parameters:
- attributes- an array of- Objectinstances in which each element is an attribute of a UDT. The order of the attributes in the array is the same order in which the attributes were defined in the UDT definition.
- map- a- java.util.Mapobject containing zero or more entries, with each entry consisting of 1) a- Stringgiving the fully qualified name of the UDT and 2) the- Classobject for the- SQLDataimplementation that defines how the UDT is to be mapped
- Throws:
- SQLException- if the- attributesor the- mapis a- nullvalue
 
 
- 
 - 
Method Detail- 
readStringpublic String readString() throws SQLException Retrieves the next attribute in thisSQLInputImplobject as aStringin the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a SQLDataimplementation.- Specified by:
- readStringin interface- SQLInput
- Returns:
- the next attribute in this SQLInputImplobject; if the value isSQL NULL, returnnull
- Throws:
- SQLException- if the read position is located at an invalid position or if there are no further values in the stream.
 
 - 
readBooleanpublic boolean readBoolean() throws SQLExceptionRetrieves the next attribute in thisSQLInputImplobject as abooleanin the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a SQLDataimplementation.- Specified by:
- readBooleanin interface- SQLInput
- Returns:
- the next attribute in this SQLInputImplobject; if the value isSQL NULL, returnnull
- Throws:
- SQLException- if the read position is located at an invalid position or if there are no further values in the stream.
 
 - 
readBytepublic byte readByte() throws SQLExceptionRetrieves the next attribute in thisSQLInputImplobject as abytein the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a SQLDataimplementation.- Specified by:
- readBytein interface- SQLInput
- Returns:
- the next attribute in this SQLInputImplobject; if the value isSQL NULL, returnnull
- Throws:
- SQLException- if the read position is located at an invalid position or if there are no further values in the stream
 
 - 
readShortpublic short readShort() throws SQLExceptionRetrieves the next attribute in thisSQLInputImplobject as ashortin the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a SQLDataimplementation.- Specified by:
- readShortin interface- SQLInput
- Returns:
- the next attribute in this SQLInputImplobject; if the value isSQL NULL, returnnull
- Throws:
- SQLException- if the read position is located at an invalid position or if there are no more values in the stream
 
 - 
readIntpublic int readInt() throws SQLExceptionRetrieves the next attribute in thisSQLInputImplobject as anintin the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a SQLDataimplementation.- Specified by:
- readIntin interface- SQLInput
- Returns:
- the next attribute in this SQLInputImplobject; if the value isSQL NULL, returnnull
- Throws:
- SQLException- if the read position is located at an invalid position or if there are no more values in the stream
 
 - 
readLongpublic long readLong() throws SQLExceptionRetrieves the next attribute in thisSQLInputImplobject as alongin the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a SQLDataimplementation.- Specified by:
- readLongin interface- SQLInput
- Returns:
- the next attribute in this SQLInputImplobject; if the value isSQL NULL, returnnull
- Throws:
- SQLException- if the read position is located at an invalid position or if there are no more values in the stream
 
 - 
readFloatpublic float readFloat() throws SQLExceptionRetrieves the next attribute in thisSQLInputImplobject as afloatin the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a SQLDataimplementation.- Specified by:
- readFloatin interface- SQLInput
- Returns:
- the next attribute in this SQLInputImplobject; if the value isSQL NULL, returnnull
- Throws:
- SQLException- if the read position is located at an invalid position or if there are no more values in the stream
 
 - 
readDoublepublic double readDouble() throws SQLExceptionRetrieves the next attribute in thisSQLInputImplobject as adoublein the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a SQLDataimplementation.- Specified by:
- readDoublein interface- SQLInput
- Returns:
- the next attribute in this SQLInputImplobject; if the value isSQL NULL, returnnull
- Throws:
- SQLException- if the read position is located at an invalid position or if there are no more values in the stream
 
 - 
readBigDecimalpublic BigDecimal readBigDecimal() throws SQLException Retrieves the next attribute in thisSQLInputImplobject as ajava.math.BigDecimal.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a SQLDataimplementation.- Specified by:
- readBigDecimalin interface- SQLInput
- Returns:
- the next attribute in this SQLInputImplobject; if the value isSQL NULL, returnnull
- Throws:
- SQLException- if the read position is located at an invalid position or if there are no more values in the stream
 
 - 
readBytespublic byte[] readBytes() throws SQLExceptionRetrieves the next attribute in thisSQLInputImplobject as an array of bytes.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a SQLDataimplementation.- Specified by:
- readBytesin interface- SQLInput
- Returns:
- the next attribute in this SQLInputImplobject; if the value isSQL NULL, returnnull
- Throws:
- SQLException- if the read position is located at an invalid position or if there are no more values in the stream
 
 - 
readDatepublic Date readDate() throws SQLException Retrieves the next attribute in thisSQLInputImplas ajava.sql.Dateobject.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a SQLDataimplementation.- Specified by:
- readDatein interface- SQLInput
- Returns:
- the next attribute in this SQLInputImplobject; if the value isSQL NULL, returnnull
- Throws:
- SQLException- if the read position is located at an invalid position or if there are no more values in the stream
 
 - 
readTimepublic Time readTime() throws SQLException Retrieves the next attribute in thisSQLInputImplobject as ajava.sql.Timeobject.This method does not perform type-safe checking to determine if the returned type is the expected type as this responsibility is delegated to the UDT mapping as implemented by a SQLDataimplementation.- Specified by:
- readTimein interface- SQLInput
- Returns:
- the attribute; if the value is SQL NULL, returnnull
- Throws:
- SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
 
 - 
readTimestamppublic Timestamp readTimestamp() throws SQLException Retrieves the next attribute in thisSQLInputImplobject as ajava.sql.Timestampobject.- Specified by:
- readTimestampin interface- SQLInput
- Returns:
- the attribute; if the value is SQL NULL, returnnull
- Throws:
- SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
 
 - 
readCharacterStreampublic Reader readCharacterStream() throws SQLException Retrieves the next attribute in thisSQLInputImplobject as a stream of Unicode characters.This method does not perform type-safe checking to determine if the returned type is the expected type as this responsibility is delegated to the UDT mapping as implemented by a SQLDataimplementation.- Specified by:
- readCharacterStreamin interface- SQLInput
- Returns:
- the attribute; if the value is SQL NULL, returnnull
- Throws:
- SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
 
 - 
readAsciiStreampublic InputStream readAsciiStream() throws SQLException Returns the next attribute in thisSQLInputImplobject as a stream of ASCII characters.This method does not perform type-safe checking to determine if the returned type is the expected type as this responsibility is delegated to the UDT mapping as implemented by a SQLDataimplementation.- Specified by:
- readAsciiStreamin interface- SQLInput
- Returns:
- the attribute; if the value is SQL NULL, returnnull
- Throws:
- SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
 
 - 
readBinaryStreampublic InputStream readBinaryStream() throws SQLException Returns the next attribute in thisSQLInputImplobject as a stream of uninterpreted bytes.This method does not perform type-safe checking to determine if the returned type is the expected type as this responsibility is delegated to the UDT mapping as implemented by a SQLDataimplementation.- Specified by:
- readBinaryStreamin interface- SQLInput
- Returns:
- the attribute; if the value is SQL NULL, returnnull
- Throws:
- SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
 
 - 
readObjectpublic Object readObject() throws SQLException Retrieves the value at the head of thisSQLInputImplobject as anObjectin the Java programming language. The actual type of the object returned is determined by the default mapping of SQL types to types in the Java programming language unless there is a custom mapping, in which case the type of the object returned is determined by this stream's type map.The JDBC technology-enabled driver registers a type map with the stream before passing the stream to the application. When the datum at the head of the stream is an SQL NULL, this method returnsnull. If the datum is an SQL structured or distinct type with a custom mapping, this method determines the SQL type of the datum at the head of the stream, constructs an object of the appropriate class, and calls the methodSQLData.readSQLon that object. ThereadSQLmethod then calls the appropriateSQLInputImpl.readXXXmethods to retrieve the attribute values from the stream.- Specified by:
- readObjectin interface- SQLInput
- Returns:
- the value at the head of the stream as an Objectin the Java programming language;nullif the value is SQLNULL
- Throws:
- SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
 
 - 
readRefpublic Ref readRef() throws SQLException Retrieves the value at the head of thisSQLInputImplobject as aRefobject in the Java programming language.- Specified by:
- readRefin interface- SQLInput
- Returns:
- a Refobject representing the SQLREFvalue at the head of the stream; if the value isSQL NULLreturnnull
- Throws:
- SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
 
 - 
readBlobpublic Blob readBlob() throws SQLException Retrieves theBLOBvalue at the head of thisSQLInputImplobject as aBlobobject in the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type as this responsibility is delegated to the UDT mapping as implemented by a SQLDataimplementation.- Specified by:
- readBlobin interface- SQLInput
- Returns:
- a Blobobject representing the SQLBLOBvalue at the head of this stream; if the value isSQL NULL, returnnull
- Throws:
- SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
 
 - 
readClobpublic Clob readClob() throws SQLException Retrieves theCLOBvalue at the head of thisSQLInputImplobject as aClobobject in the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type as this responsibility is delegated to the UDT mapping as implemented by a SQLDataimplementation.- Specified by:
- readClobin interface- SQLInput
- Returns:
- a Clobobject representing the SQLCLOBvalue at the head of the stream; if the value isSQL NULL, returnnull
- Throws:
- SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
 
 - 
readArraypublic Array readArray() throws SQLException Reads an SQLARRAYvalue from the stream and returns it as anArrayobject in the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type as this responsibility is delegated to the UDT mapping as implemented by a SQLDataimplementation.- Specified by:
- readArrayin interface- SQLInput
- Returns:
- an Arrayobject representing the SQLARRAYvalue at the head of the stream; * if the value isSQL NULL, returnnull
- Throws:
- SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
 
 - 
wasNullpublic boolean wasNull() throws SQLExceptionAscertains whether the last value read from thisSQLInputImplobject wasnull.- Specified by:
- wasNullin interface- SQLInput
- Returns:
- trueif the SQL value read most recently was- null; otherwise,- false; by default it will return false
- Throws:
- SQLException- if an error occurs determining the last value read was a- nullvalue or not;
 
 - 
readURLpublic URL readURL() throws SQLException Reads an SQLDATALINKvalue from the stream and returns it as anURLobject in the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type as this responsibility is delegated to the UDT mapping as implemented by a SQLDataimplementation.- Specified by:
- readURLin interface- SQLInput
- Returns:
- an URLobject representing the SQLDATALINKvalue at the head of the stream; * if the value isSQL NULL, returnnull
- Throws:
- SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
 
 - 
readNClobpublic NClob readNClob() throws SQLException Reads an SQLNCLOBvalue from the stream and returns it as aClobobject in the Java programming language.- Specified by:
- readNClobin interface- SQLInput
- Returns:
- a NClobobject representing data of the SQLNCLOBvalue at the head of the stream;nullif the value read is SQLNULL
- Throws:
- SQLException- if a database access error occurs
- Since:
- 1.6
 
 - 
readNStringpublic String readNString() throws SQLException Reads the next attribute in the stream and returns it as aStringin the Java programming language. It is intended for use when accessingNCHAR,NVARCHARandLONGNVARCHARcolumns.- Specified by:
- readNStringin interface- SQLInput
- Returns:
- the attribute; if the value is SQL NULL, returnsnull
- Throws:
- SQLException- if a database access error occurs
- Since:
- 1.6
 
 - 
readSQLXMLpublic SQLXML readSQLXML() throws SQLException Reads an SQLXMLvalue from the stream and returns it as aSQLXMLobject in the Java programming language.- Specified by:
- readSQLXMLin interface- SQLInput
- Returns:
- a SQLXMLobject representing data of the SQLXMLvalue at the head of the stream;nullif the value read is SQLNULL
- Throws:
- SQLException- if a database access error occurs
- Since:
- 1.6
 
 - 
readRowIdpublic RowId readRowId() throws SQLException Reads an SQLROWIDvalue from the stream and returns it as aRowIdobject in the Java programming language.- Specified by:
- readRowIdin interface- SQLInput
- Returns:
- a RowIdobject representing data of the SQLROWIDvalue at the head of the stream;nullif the value read is SQLNULL
- Throws:
- SQLException- if a database access error occurs
- Since:
- 1.6
 
 
- 
 
-