- java.lang.Object
- 
- javax.sql.rowset.serial.SQLOutputImpl
 
- 
- All Implemented Interfaces:
- SQLOutput
 
 public class SQLOutputImpl extends Object implements SQLOutput The output stream for writing the attributes of a custom-mapped user-defined type (UDT) back to the database. The driver uses this interface internally, and its methods are never directly invoked by an application programmer.When an application calls the method PreparedStatement.setObject, the driver checks to see whether the value to be written is a UDT with a custom mapping. If it is, there will be an entry in a type map containing theClassobject for the class that implementsSQLDatafor this UDT. If the value to be written is an instance ofSQLData, the driver will create an instance ofSQLOutputImpland pass it to the methodSQLData.writeSQL. The methodwriteSQLin turn calls the appropriateSQLOutputImpl.writeXXXmethods to write data from theSQLDataobject to theSQLOutputImploutput stream as the representation of an SQL user-defined type.- Since:
- 1.5
 
- 
- 
Constructor SummaryConstructors Constructor Description SQLOutputImpl(Vector<?> attributes, Map<String,?> map)Creates a newSQLOutputImplobject initialized with the given vector of attributes and type map.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidwriteArray(Array x)Writes anArrayobject in the Java programming language to thisSQLOutputImplobject.voidwriteAsciiStream(InputStream x)Writes a stream of ASCII characters to thisSQLOutputImplobject.voidwriteBigDecimal(BigDecimal x)Writes ajava.math.BigDecimalobject in the Java programming language to thisSQLOutputImplobject.voidwriteBinaryStream(InputStream x)Writes a stream of uninterpreted bytes to thisSQLOutputImplobject.voidwriteBlob(Blob x)Writes aBlobobject in the Java programming language to thisSQLOutputImplobject.voidwriteBoolean(boolean x)Writes abooleanin the Java programming language to thisSQLOutputImplobject.voidwriteByte(byte x)Writes abytein the Java programming language to thisSQLOutputImplobject.voidwriteBytes(byte[] x)Writes an array ofbytesin the Java programming language to thisSQLOutputImplobject.voidwriteCharacterStream(Reader x)Writes a stream of Unicode characters to thisSQLOutputImplobject.voidwriteClob(Clob x)Writes aClobobject in the Java programming language to thisSQLOutputImplobject.voidwriteDate(Date x)Writes ajava.sql.Dateobject in the Java programming language to thisSQLOutputImplobject.voidwriteDouble(double x)Writes adoublein the Java programming language to thisSQLOutputImplobject.voidwriteFloat(float x)Writes afloatin the Java programming language to thisSQLOutputImplobject.voidwriteInt(int x)Writes anintin the Java programming language to thisSQLOutputImplobject.voidwriteLong(long x)Writes alongin the Java programming language to thisSQLOutputImplobject.voidwriteNClob(NClob x)Writes an SQLNCLOBvalue to the stream.voidwriteNString(String x)Writes the next attribute to the stream as aStringin the Java programming language.voidwriteObject(SQLData x)Writes to the stream the data contained in the givenSQLDataobject.voidwriteRef(Ref x)Writes aRefobject in the Java programming language to thisSQLOutputImplobject.voidwriteRowId(RowId x)Writes an SQLROWIDvalue to the stream.voidwriteShort(short x)Writes ashortin the Java programming language to thisSQLOutputImplobject.voidwriteSQLXML(SQLXML x)Writes an SQLXMLvalue to the stream.voidwriteString(String x)Writes aStringin the Java programming language to thisSQLOutputImplobject.voidwriteStruct(Struct x)Writes aStructobject in the Java programming language to thisSQLOutputImplobject.voidwriteTime(Time x)Writes ajava.sql.Timeobject in the Java programming language to thisSQLOutputImplobject.voidwriteTimestamp(Timestamp x)Writes ajava.sql.Timestampobject in the Java programming language to thisSQLOutputImplobject.voidwriteURL(URL url)Writes anjava.sql.Type.DATALINKobject in the Java programming language to thisSQLOutputImplobject.- 
Methods declared in class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods declared in interface java.sql.SQLOutputwriteObject
 
- 
 
- 
- 
- 
Constructor Detail- 
SQLOutputImplpublic SQLOutputImpl(Vector<?> attributes, Map<String,?> map) throws SQLException Creates a newSQLOutputImplobject initialized with the given vector of attributes and type map. The driver will use the type map to determine whichSQLData.writeSQLmethod to invoke. This method will then call the appropriateSQLOutputImplwriter methods in order and thereby write the attributes to the new output stream.- Parameters:
- attributes- a- Vectorobject containing the attributes of the UDT to be mapped to one or more objects in the Java programming language
- map- a- java.util.Mapobject containing zero or more entries, with each entry consisting of 1) a- Stringgiving the fully qualified name of a 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- 
writeStringpublic void writeString(String x) throws SQLException Writes aStringin the Java programming language to thisSQLOutputImplobject. The driver converts it to an SQLCHAR,VARCHAR, orLONGVARCHARbefore returning it to the database.- Specified by:
- writeStringin interface- SQLOutput
- Parameters:
- x- the value to pass to the database
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeBooleanpublic void writeBoolean(boolean x) throws SQLExceptionWrites abooleanin the Java programming language to thisSQLOutputImplobject. The driver converts it to an SQLBITbefore returning it to the database.- Specified by:
- writeBooleanin interface- SQLOutput
- Parameters:
- x- the value to pass to the database
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeBytepublic void writeByte(byte x) throws SQLExceptionWrites abytein the Java programming language to thisSQLOutputImplobject. The driver converts it to an SQLBITbefore returning it to the database.- Specified by:
- writeBytein interface- SQLOutput
- Parameters:
- x- the value to pass to the database
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeShortpublic void writeShort(short x) throws SQLExceptionWrites ashortin the Java programming language to thisSQLOutputImplobject. The driver converts it to an SQLSMALLINTbefore returning it to the database.- Specified by:
- writeShortin interface- SQLOutput
- Parameters:
- x- the value to pass to the database
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeIntpublic void writeInt(int x) throws SQLExceptionWrites anintin the Java programming language to thisSQLOutputImplobject. The driver converts it to an SQLINTEGERbefore returning it to the database.- Specified by:
- writeIntin interface- SQLOutput
- Parameters:
- x- the value to pass to the database
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeLongpublic void writeLong(long x) throws SQLExceptionWrites alongin the Java programming language to thisSQLOutputImplobject. The driver converts it to an SQLBIGINTbefore returning it to the database.- Specified by:
- writeLongin interface- SQLOutput
- Parameters:
- x- the value to pass to the database
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeFloatpublic void writeFloat(float x) throws SQLExceptionWrites afloatin the Java programming language to thisSQLOutputImplobject. The driver converts it to an SQLREALbefore returning it to the database.- Specified by:
- writeFloatin interface- SQLOutput
- Parameters:
- x- the value to pass to the database
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeDoublepublic void writeDouble(double x) throws SQLExceptionWrites adoublein the Java programming language to thisSQLOutputImplobject. The driver converts it to an SQLDOUBLEbefore returning it to the database.- Specified by:
- writeDoublein interface- SQLOutput
- Parameters:
- x- the value to pass to the database
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeBigDecimalpublic void writeBigDecimal(BigDecimal x) throws SQLException Writes ajava.math.BigDecimalobject in the Java programming language to thisSQLOutputImplobject. The driver converts it to an SQLNUMERICbefore returning it to the database.- Specified by:
- writeBigDecimalin interface- SQLOutput
- Parameters:
- x- the value to pass to the database
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeBytespublic void writeBytes(byte[] x) throws SQLExceptionWrites an array ofbytesin the Java programming language to thisSQLOutputImplobject. The driver converts it to an SQLVARBINARYorLONGVARBINARYbefore returning it to the database.- Specified by:
- writeBytesin interface- SQLOutput
- Parameters:
- x- the value to pass to the database
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeDatepublic void writeDate(Date x) throws SQLException Writes ajava.sql.Dateobject in the Java programming language to thisSQLOutputImplobject. The driver converts it to an SQLDATEbefore returning it to the database.- Specified by:
- writeDatein interface- SQLOutput
- Parameters:
- x- the value to pass to the database
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeTimepublic void writeTime(Time x) throws SQLException Writes ajava.sql.Timeobject in the Java programming language to thisSQLOutputImplobject. The driver converts it to an SQLTIMEbefore returning it to the database.- Specified by:
- writeTimein interface- SQLOutput
- Parameters:
- x- the value to pass to the database
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeTimestamppublic void writeTimestamp(Timestamp x) throws SQLException Writes ajava.sql.Timestampobject in the Java programming language to thisSQLOutputImplobject. The driver converts it to an SQLTIMESTAMPbefore returning it to the database.- Specified by:
- writeTimestampin interface- SQLOutput
- Parameters:
- x- the value to pass to the database
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeCharacterStreampublic void writeCharacterStream(Reader x) throws SQLException Writes a stream of Unicode characters to thisSQLOutputImplobject. The driver will do any necessary conversion from Unicode to the databaseCHARformat.- Specified by:
- writeCharacterStreamin interface- SQLOutput
- Parameters:
- x- the value to pass to the database
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeAsciiStreampublic void writeAsciiStream(InputStream x) throws SQLException Writes a stream of ASCII characters to thisSQLOutputImplobject. The driver will do any necessary conversion from ASCII to the databaseCHARformat.- Specified by:
- writeAsciiStreamin interface- SQLOutput
- Parameters:
- x- the value to pass to the database
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeBinaryStreampublic void writeBinaryStream(InputStream x) throws SQLException Writes a stream of uninterpreted bytes to thisSQLOutputImplobject.- Specified by:
- writeBinaryStreamin interface- SQLOutput
- Parameters:
- x- the value to pass to the database
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeObjectpublic void writeObject(SQLData x) throws SQLException Writes to the stream the data contained in the givenSQLDataobject. When theSQLDataobject isnull, this method writes an SQLNULLto the stream. Otherwise, it calls theSQLData.writeSQLmethod of the given object, which writes the object's attributes to the stream.The implementation of the method SQLData.writeSQcalls the appropriateSQLOutputImpl.writeXXXmethod(s) for writing each of the object's attributes in order. The attributes must be read from anSQLInputinput stream and written to anSQLOutputImploutput stream in the same order in which they were listed in the SQL definition of the user-defined type.- Specified by:
- writeObjectin interface- SQLOutput
- Parameters:
- x- the object representing data of an SQL structured or distinct type
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeRefpublic void writeRef(Ref x) throws SQLException Writes aRefobject in the Java programming language to thisSQLOutputImplobject. The driver converts it to a serializableSerialRefSQLREFvalue before returning it to the database.- Specified by:
- writeRefin interface- SQLOutput
- Parameters:
- x- an object representing an SQL- REFvalue
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeBlobpublic void writeBlob(Blob x) throws SQLException Writes aBlobobject in the Java programming language to thisSQLOutputImplobject. The driver converts it to a serializableSerialBlobSQLBLOBvalue before returning it to the database.- Specified by:
- writeBlobin interface- SQLOutput
- Parameters:
- x- an object representing an SQL- BLOBvalue
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeClobpublic void writeClob(Clob x) throws SQLException Writes aClobobject in the Java programming language to thisSQLOutputImplobject. The driver converts it to a serializableSerialClobSQLCLOBvalue before returning it to the database.- Specified by:
- writeClobin interface- SQLOutput
- Parameters:
- x- an object representing an SQL- CLOBvalue
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeStructpublic void writeStruct(Struct x) throws SQLException Writes aStructobject in the Java programming language to thisSQLOutputImplobject. The driver converts this value to an SQL structured type before returning it to the database.This method should be used when an SQL structured type has been mapped to a Structobject in the Java programming language (the standard mapping). The methodwriteObjectshould be used if an SQL structured type has been custom mapped to a class in the Java programming language.- Specified by:
- writeStructin interface- SQLOutput
- Parameters:
- x- an object representing the attributes of an SQL structured type
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeArraypublic void writeArray(Array x) throws SQLException Writes anArrayobject in the Java programming language to thisSQLOutputImplobject. The driver converts this value to a serializableSerialArraySQLARRAYvalue before returning it to the database.- Specified by:
- writeArrayin interface- SQLOutput
- Parameters:
- x- an object representing an SQL- ARRAYvalue
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeURLpublic void writeURL(URL url) throws SQLException Writes anjava.sql.Type.DATALINKobject in the Java programming language to thisSQLOutputImplobject. The driver converts this value to a serializableSerialDatalinkSQLDATALINKvalue before return it to the database.- Specified by:
- writeURLin interface- SQLOutput
- Parameters:
- url- an object representing a SQL- DATALINKvalue
- Throws:
- SQLException- if the- SQLOutputImplobject is in use by a- SQLDataobject attempting to write the attribute values of a UDT to the database.
 
 - 
writeNStringpublic void writeNString(String x) throws SQLException Writes the next attribute to the stream as aStringin the Java programming language. The driver converts this to a SQLNCHARorNVARCHARorLONGNVARCHARvalue (depending on the argument's size relative to the driver's limits onNVARCHARvalues) when it sends it to the stream.- Specified by:
- writeNStringin interface- SQLOutput
- Parameters:
- x- the value to pass to the database
- Throws:
- SQLException- if a database access error occurs
- Since:
- 1.6
 
 - 
writeNClobpublic void writeNClob(NClob x) throws SQLException Writes an SQLNCLOBvalue to the stream.- Specified by:
- writeNClobin interface- SQLOutput
- Parameters:
- x- a- NClobobject representing data of an SQL- NCLOBvalue
- Throws:
- SQLException- if a database access error occurs
- Since:
- 1.6
 
 - 
writeRowIdpublic void writeRowId(RowId x) throws SQLException Writes an SQLROWIDvalue to the stream.- Specified by:
- writeRowIdin interface- SQLOutput
- Parameters:
- x- a- RowIdobject representing data of an SQL- ROWIDvalue
- Throws:
- SQLException- if a database access error occurs
- Since:
- 1.6
 
 - 
writeSQLXMLpublic void writeSQLXML(SQLXML x) throws SQLException Writes an SQLXMLvalue to the stream.- Specified by:
- writeSQLXMLin interface- SQLOutput
- Parameters:
- x- a- SQLXMLobject representing data of an SQL- XMLvalue
- Throws:
- SQLException- if a database access error occurs
- Since:
- 1.6
 
 
- 
 
-