APIdia Launch Partner
Top Description Fields Constructors Methods
javax.sql.rowset.serial

public Class SQLOutputImpl

extends Object
implements SQLOutput
Class Inheritance
All Implemented Interfaces
java.sql.SQLOutput
Imports
java.io.BufferedReader, .IOException, .InputStreamReader, java.sql.*, java.util.Map, .Vector

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 the Class object for the class that implements SQLData for this UDT. If the value to be written is an instance of SQLData, the driver will create an instance of SQLOutputImpl and pass it to the method SQLData.writeSQL. The method writeSQL in turn calls the appropriate SQLOutputImpl.writeXXX methods to write data from the SQLData object to the SQLOutputImpl output stream as the representation of an SQL user-defined type.

Since
1.5

Field Summary

Modifier and TypeField and Description
private Vector<E>
attribs

A reference to an existing vector that contains the attributes of a Struct object.

private Map<K, V>
map

The type map the driver supplies to a newly created SQLOutputImpl object.

Constructor Summary

AccessConstructor and Description
public
SQLOutputImpl(Vector<?>
a Vector object containing the attributes of the UDT to be mapped to one or more objects in the Java programming language
attributes
,
Map<String, ?>
a java.util.Map object containing zero or more entries, with each entry consisting of 1) a String giving the fully qualified name of a UDT and 2) the Class object for the SQLData implementation that defines how the UDT is to be mapped
map
)

Creates a new SQLOutputImpl object initialized with the given vector of attributes and type map.

Method Summary

Modifier and TypeMethod and Description
public void
writeArray(Array
an object representing an SQL ARRAY value
x
)

Implements java.sql.SQLOutput.writeArray.

Writes an Array object in the Java programming language to this SQLOutputImpl object.

public void
writeAsciiStream(InputStream
the value to pass to the database
x
)

Implements java.sql.SQLOutput.writeAsciiStream.

Writes a stream of ASCII characters to this SQLOutputImpl object.

public void
writeBigDecimal(BigDecimal
the value to pass to the database
x
)

Implements java.sql.SQLOutput.writeBigDecimal.

Writes a java.math.BigDecimal object in the Java programming language to this SQLOutputImpl object.

public void
writeBinaryStream(InputStream
the value to pass to the database
x
)

Implements java.sql.SQLOutput.writeBinaryStream.

Writes a stream of uninterpreted bytes to this SQLOutputImpl object.

public void
writeBlob(Blob
an object representing an SQL BLOB value
x
)

Implements java.sql.SQLOutput.writeBlob.

Writes a Blob object in the Java programming language to this SQLOutputImpl object.

public void
writeBoolean(boolean
the value to pass to the database
x
)

Implements java.sql.SQLOutput.writeBoolean.

Writes a boolean in the Java programming language to this SQLOutputImpl object.

public void
writeByte(byte
the value to pass to the database
x
)

Implements java.sql.SQLOutput.writeByte.

Writes a byte in the Java programming language to this SQLOutputImpl object.

public void
writeBytes(byte[]
the value to pass to the database
x
)

Implements java.sql.SQLOutput.writeBytes.

Writes an array of bytes in the Java programming language to this SQLOutputImpl object.

public void
writeCharacterStream(Reader
the value to pass to the database
x
)

Implements java.sql.SQLOutput.writeCharacterStream.

Writes a stream of Unicode characters to this SQLOutputImpl object.

public void
writeClob(Clob
an object representing an SQL CLOB value
x
)

Implements java.sql.SQLOutput.writeClob.

Writes a Clob object in the Java programming language to this SQLOutputImpl object.

public void
writeDate(Date
the value to pass to the database
x
)

Implements java.sql.SQLOutput.writeDate.

Writes a java.sql.Date object in the Java programming language to this SQLOutputImpl object.

public void
writeDouble(double
the value to pass to the database
x
)

Implements java.sql.SQLOutput.writeDouble.

Writes a double in the Java programming language to this SQLOutputImpl object.

public void
writeFloat(float
the value to pass to the database
x
)

Implements java.sql.SQLOutput.writeFloat.

Writes a float in the Java programming language to this SQLOutputImpl object.

public void
writeInt(int
the value to pass to the database
x
)

Implements java.sql.SQLOutput.writeInt.

Writes an int in the Java programming language to this SQLOutputImpl object.

public void
writeLong(long
the value to pass to the database
x
)

Implements java.sql.SQLOutput.writeLong.

Writes a long in the Java programming language to this SQLOutputImpl object.

public void
writeNClob(NClob
a NClob object representing data of an SQL NCLOB value
x
)

Implements java.sql.SQLOutput.writeNClob.

Writes an SQL NCLOB value to the stream.

public void
writeNString(String
the value to pass to the database
x
)

Implements java.sql.SQLOutput.writeNString.

Writes the next attribute to the stream as a String in the Java programming language.

public void
writeObject(SQLData
the object representing data of an SQL structured or distinct type
x
)

Implements java.sql.SQLOutput.writeObject.

Writes to the stream the data contained in the given SQLData object.

public void
writeRef(Ref
an object representing an SQL REF value
x
)

Implements java.sql.SQLOutput.writeRef.

Writes a Ref object in the Java programming language to this SQLOutputImpl object.

public void
writeRowId(RowId
a RowId object representing data of an SQL ROWID value
x
)

Implements java.sql.SQLOutput.writeRowId.

Writes an SQL ROWID value to the stream.

public void
writeShort(short
the value to pass to the database
x
)

Implements java.sql.SQLOutput.writeShort.

Writes a short in the Java programming language to this SQLOutputImpl object.

public void
writeSQLXML(SQLXML
a SQLXML object representing data of an SQL XML value
x
)

Implements java.sql.SQLOutput.writeSQLXML.

Writes an SQL XML value to the stream.

public void
writeString(String
the value to pass to the database
x
)

Implements java.sql.SQLOutput.writeString.

Writes a String in the Java programming language to this SQLOutputImpl object.

public void
writeStruct(Struct
an object representing the attributes of an SQL structured type
x
)

Implements java.sql.SQLOutput.writeStruct.

Writes a Struct object in the Java programming language to this SQLOutputImpl object.

public void
writeTime(Time
the value to pass to the database
x
)

Implements java.sql.SQLOutput.writeTime.

Writes a java.sql.Time object in the Java programming language to this SQLOutputImpl object.

public void
writeTimestamp(Timestamp
the value to pass to the database
x
)

Implements java.sql.SQLOutput.writeTimestamp.

Writes a java.sql.Timestamp object in the Java programming language to this SQLOutputImpl object.

public void
writeURL(URL
an object representing a SQL DATALINK value
url
)

Implements java.sql.SQLOutput.writeURL.

Writes an java.sql.Type.DATALINK object in the Java programming language to this SQLOutputImpl object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attribsback to summary
private Vector<E> attribs

A reference to an existing vector that contains the attributes of a Struct object.

Annotations
@SuppressWarnings:rawtypes
mapback to summary
private Map<K, V> map

The type map the driver supplies to a newly created SQLOutputImpl object. This type map indicates the SQLData class whose writeSQL method will be called. This method will in turn call the appropriate SQLOutputImpl writer methods.

Annotations
@SuppressWarnings:rawtypes

Constructor Detail

SQLOutputImplback to summary
public SQLOutputImpl(Vector<?> attributes, Map<String, ?> map) throws SQLException

Creates a new SQLOutputImpl object initialized with the given vector of attributes and type map. The driver will use the type map to determine which SQLData.writeSQL method to invoke. This method will then call the appropriate SQLOutputImpl writer methods in order and thereby write the attributes to the new output stream.

Parameters
attributes:Vector<?>

a Vector object containing the attributes of the UDT to be mapped to one or more objects in the Java programming language

map:Map<String, ?>

a java.util.Map object containing zero or more entries, with each entry consisting of 1) a String giving the fully qualified name of a UDT and 2) the Class object for the SQLData implementation that defines how the UDT is to be mapped

Exceptions
SQLException:
if the attributes or the map is a null value

Method Detail

writeArrayback to summary
public void writeArray(Array x) throws SQLException

Implements java.sql.SQLOutput.writeArray.

Writes an Array object in the Java programming language to this SQLOutputImpl object. The driver converts this value to a serializable SerialArray SQL ARRAY value before returning it to the database.

Parameters
x:Array

an object representing an SQL ARRAY value

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeAsciiStreamback to summary
public void writeAsciiStream(InputStream x) throws SQLException

Implements java.sql.SQLOutput.writeAsciiStream.

Writes a stream of ASCII characters to this SQLOutputImpl object. The driver will do any necessary conversion from ASCII to the database CHAR format.

Parameters
x:InputStream

the value to pass to the database

Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeBigDecimalback to summary
public void writeBigDecimal(BigDecimal x) throws SQLException

Implements java.sql.SQLOutput.writeBigDecimal.

Writes a java.math.BigDecimal object in the Java programming language to this SQLOutputImpl object. The driver converts it to an SQL NUMERIC before returning it to the database.

Parameters
x:BigDecimal

the value to pass to the database

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeBinaryStreamback to summary
public void writeBinaryStream(InputStream x) throws SQLException

Implements java.sql.SQLOutput.writeBinaryStream.

Writes a stream of uninterpreted bytes to this SQLOutputImpl object.

Parameters
x:InputStream

the value to pass to the database

Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeBlobback to summary
public void writeBlob(Blob x) throws SQLException

Implements java.sql.SQLOutput.writeBlob.

Writes a Blob object in the Java programming language to this SQLOutputImpl object. The driver converts it to a serializable SerialBlob SQL BLOB value before returning it to the database.

Parameters
x:Blob

an object representing an SQL BLOB value

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeBooleanback to summary
public void writeBoolean(boolean x) throws SQLException

Implements java.sql.SQLOutput.writeBoolean.

Writes a boolean in the Java programming language to this SQLOutputImpl object. The driver converts it to an SQL BIT before returning it to the database.

Parameters
x:boolean

the value to pass to the database

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeByteback to summary
public void writeByte(byte x) throws SQLException

Implements java.sql.SQLOutput.writeByte.

Writes a byte in the Java programming language to this SQLOutputImpl object. The driver converts it to an SQL BIT before returning it to the database.

Parameters
x:byte

the value to pass to the database

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeBytesback to summary
public void writeBytes(byte[] x) throws SQLException

Implements java.sql.SQLOutput.writeBytes.

Writes an array of bytes in the Java programming language to this SQLOutputImpl object. The driver converts it to an SQL VARBINARY or LONGVARBINARY before returning it to the database.

Parameters
x:byte[]

the value to pass to the database

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeCharacterStreamback to summary
public void writeCharacterStream(Reader x) throws SQLException

Implements java.sql.SQLOutput.writeCharacterStream.

Writes a stream of Unicode characters to this SQLOutputImpl object. The driver will do any necessary conversion from Unicode to the database CHAR format.

Parameters
x:Reader

the value to pass to the database

Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeClobback to summary
public void writeClob(Clob x) throws SQLException

Implements java.sql.SQLOutput.writeClob.

Writes a Clob object in the Java programming language to this SQLOutputImpl object. The driver converts it to a serializable SerialClob SQL CLOB value before returning it to the database.

Parameters
x:Clob

an object representing an SQL CLOB value

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeDateback to summary
public void writeDate(Date x) throws SQLException

Implements java.sql.SQLOutput.writeDate.

Writes a java.sql.Date object in the Java programming language to this SQLOutputImpl object. The driver converts it to an SQL DATE before returning it to the database.

Parameters
x:Date

the value to pass to the database

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeDoubleback to summary
public void writeDouble(double x) throws SQLException

Implements java.sql.SQLOutput.writeDouble.

Writes a double in the Java programming language to this SQLOutputImpl object. The driver converts it to an SQL DOUBLE before returning it to the database.

Parameters
x:double

the value to pass to the database

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeFloatback to summary
public void writeFloat(float x) throws SQLException

Implements java.sql.SQLOutput.writeFloat.

Writes a float in the Java programming language to this SQLOutputImpl object. The driver converts it to an SQL REAL before returning it to the database.

Parameters
x:float

the value to pass to the database

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeIntback to summary
public void writeInt(int x) throws SQLException

Implements java.sql.SQLOutput.writeInt.

Writes an int in the Java programming language to this SQLOutputImpl object. The driver converts it to an SQL INTEGER before returning it to the database.

Parameters
x:int

the value to pass to the database

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeLongback to summary
public void writeLong(long x) throws SQLException

Implements java.sql.SQLOutput.writeLong.

Writes a long in the Java programming language to this SQLOutputImpl object. The driver converts it to an SQL BIGINT before returning it to the database.

Parameters
x:long

the value to pass to the database

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeNClobback to summary
public void writeNClob(NClob x) throws SQLException

Implements java.sql.SQLOutput.writeNClob.

Writes an SQL NCLOB value to the stream.

Parameters
x:NClob

a NClob object representing data of an SQL NCLOB value

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if a database access error occurs
Since
1.6
writeNStringback to summary
public void writeNString(String x) throws SQLException

Implements java.sql.SQLOutput.writeNString.

Writes the next attribute to the stream as a String in the Java programming language. The driver converts this to a SQL NCHAR or NVARCHAR or LONGNVARCHAR value (depending on the argument's size relative to the driver's limits on NVARCHAR values) when it sends it to the stream.

Parameters
x:String

the value to pass to the database

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if a database access error occurs
Since
1.6
writeObjectback to summary
public void writeObject(SQLData x) throws SQLException

Implements java.sql.SQLOutput.writeObject.

Writes to the stream the data contained in the given SQLData object. When the SQLData object is null, this method writes an SQL NULL to the stream. Otherwise, it calls the SQLData.writeSQL method of the given object, which writes the object's attributes to the stream.

The implementation of the method SQLData.writeSQ calls the appropriate SQLOutputImpl.writeXXX method(s) for writing each of the object's attributes in order. The attributes must be read from an SQLInput input stream and written to an SQLOutputImpl output stream in the same order in which they were listed in the SQL definition of the user-defined type.

Parameters
x:SQLData

the object representing data of an SQL structured or distinct type

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeRefback to summary
public void writeRef(Ref x) throws SQLException

Implements java.sql.SQLOutput.writeRef.

Writes a Ref object in the Java programming language to this SQLOutputImpl object. The driver converts it to a serializable SerialRef SQL REF value before returning it to the database.

Parameters
x:Ref

an object representing an SQL REF value

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeRowIdback to summary
public void writeRowId(RowId x) throws SQLException

Implements java.sql.SQLOutput.writeRowId.

Writes an SQL ROWID value to the stream.

Parameters
x:RowId

a RowId object representing data of an SQL ROWID value

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if a database access error occurs
Since
1.6
writeShortback to summary
public void writeShort(short x) throws SQLException

Implements java.sql.SQLOutput.writeShort.

Writes a short in the Java programming language to this SQLOutputImpl object. The driver converts it to an SQL SMALLINT before returning it to the database.

Parameters
x:short

the value to pass to the database

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeSQLXMLback to summary
public void writeSQLXML(SQLXML x) throws SQLException

Implements java.sql.SQLOutput.writeSQLXML.

Writes an SQL XML value to the stream.

Parameters
x:SQLXML

a SQLXML object representing data of an SQL XML value

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if a database access error occurs
Since
1.6
writeStringback to summary
public void writeString(String x) throws SQLException

Implements java.sql.SQLOutput.writeString.

Writes a String in the Java programming language to this SQLOutputImpl object. The driver converts it to an SQL CHAR, VARCHAR, or LONGVARCHAR before returning it to the database.

Parameters
x:String

the value to pass to the database

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeStructback to summary
public void writeStruct(Struct x) throws SQLException

Implements java.sql.SQLOutput.writeStruct.

Writes a Struct object in the Java programming language to this SQLOutputImpl object. 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 Struct object in the Java programming language (the standard mapping). The method writeObject should be used if an SQL structured type has been custom mapped to a class in the Java programming language.

Parameters
x:Struct

an object representing the attributes of an SQL structured type

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeTimeback to summary
public void writeTime(Time x) throws SQLException

Implements java.sql.SQLOutput.writeTime.

Writes a java.sql.Time object in the Java programming language to this SQLOutputImpl object. The driver converts it to an SQL TIME before returning it to the database.

Parameters
x:Time

the value to pass to the database

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeTimestampback to summary
public void writeTimestamp(Timestamp x) throws SQLException

Implements java.sql.SQLOutput.writeTimestamp.

Writes a java.sql.Timestamp object in the Java programming language to this SQLOutputImpl object. The driver converts it to an SQL TIMESTAMP before returning it to the database.

Parameters
x:Timestamp

the value to pass to the database

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.
writeURLback to summary
public void writeURL(URL url) throws SQLException

Implements java.sql.SQLOutput.writeURL.

Writes an java.sql.Type.DATALINK object in the Java programming language to this SQLOutputImpl object. The driver converts this value to a serializable SerialDatalink SQL DATALINK value before return it to the database.

Parameters
url:URL

an object representing a SQL DATALINK value

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
if the SQLOutputImpl object is in use by a SQLData object attempting to write the attribute values of a UDT to the database.