com.informix.jdbc

## Class IfxUDTOutput

- java.lang.Object
- - com.informix.jdbc.IfxUDTOutput

All Implemented Interfaces:
  IfmxUDTSQLOutput, SQLUDTOutput, java.sql.SQLOutput

    public class IfxUDTOutput
    extends java.lang.Object
    implements SQLUDTOutput, IfmxUDTSQLOutput

### Field Summary

Fields
`protected IfxConnection` `conn`
`protected Trace` `trace`

### Method Summary

Methods
`int` `available()` Returns the number of valid bytes remaining in this output stream.
`boolean` `getAutoAlignment()` Returns true if auto alignment is enabled and false if auto alignment has been disabled.
`int` `getCurrentPosition()` Returns the current position in the output stream.
`IfxUDTInfo` `getUDTInfo(int xid)` Get general information about opaque and distinct types and detailed information for complex types.
`IfxUDTInfo` `getUDTInfo(java.lang.String name, java.lang.String owner)` Get general information about opaque and distinct types and detailed information for complex types.
`int` `length()` Gets the total length written to the data stream.
`void` `setAutoAlignment(boolean value)` Enable or disable automatic alignment.
`void` `setCurrentPosition(int position)` Resets the current position.
`void` `skipBytes(int len)` Skips over and discards len bytes of data from the output stream.
`byte[]` `toByteArray()`
`void` `writeArray(java.sql.Array x)` Write an array to the stream.
`void` `writeAsciiStream(java.io.InputStream x)` Return the next attribute to the stream as a stream of ASCII characters.
`void` `writeBigDecimal(java.math.BigDecimal x)` Write the next attribute to the stream as a java.math.BigDecimal object.
`void` `writeBinaryStream(java.io.InputStream x)` Return the next attribute to the stream as a stream of uninterpreted bytes.
`void` `writeBlob(java.sql.Blob x)` Write a BLOB to the stream.
`void` `writeBoolean(boolean x)` Write the next attribute to the stream as a Java boolean.
`void` `writeByte(byte x)` Write the next attribute to the stream as a Java byte.
`void` `writeBytes(byte[] x)` Write the next attribute to the stream as an array of bytes.
`void` `writeBytes(byte[] x, int len)` Write the next attribute to the stream as a Java byte array.
`void` `writeCharacterStream(java.io.Reader x)` Return the next attribute to the stream as a stream of Unicode characters.
`void` `writeClob(java.sql.Clob x)` Write a CLOB to the stream.
`void` `writeDate(java.sql.Date x)` Write the next attribute to the stream as a java.sql.Date object.
`void` `writeDouble(double x)` Write the next attribute to the stream as a Java double.
`void` `writeFloat(float x)` Write the next attribute to the stream as a Java float.
`void` `writeInt(int x)` Write the next attribute to the stream as a Java int.
`void` `writeInterval(Interval x)` Write the next attribute to the stream as a Interval object (IntervalYM or IntervalDF).
`void` `writeLong(long x)` Write the next attribute to the stream as a Java long.
`void` `writeLongBigint(long x)`
`void` `writeNClob(java.sql.NClob x)`
`void` `writeNString(java.lang.String x)`
`void` `writeObject(java.sql.SQLData x)` Write to the stream the data contained in the given object.
`void` `writeRef(java.sql.Ref x)` Write a REF(<structured-type>) to the stream.
`void` `writeRowId(java.sql.RowId x)`
`void` `writeShort(short x)` Write the next attribute to the stream as a Java short.
`void` `writeSQLXML(java.sql.SQLXML x)`
`void` `writeString(java.lang.String x)` Write the next attribute to the stream as a Java String.
`void` `writeString(java.lang.String x, int len)` Write the next attribute to the stream as a Java String.
`void` `writeString(java.lang.String x, java.lang.String dbEnc)` Write the string to the stream with dbencoding.
`void` `writeStruct(java.sql.Struct x)` Write a structured-type to the stream.
`void` `writeTime(java.sql.Time x)` Write the next attribute to the stream as a java.sql.Time object.
`void` `writeTimestamp(java.sql.Timestamp x)` Write the next attribute to the stream as a java.sql.Timestamp object.
`void` `writeURL(java.net.URL x)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.sql.SQLOutput

`writeBytes, writeDate, writeString, writeTime`

### Field Detail

#### conn

    protected IfxConnection conn

#### trace

    protected Trace trace

### Method Detail

#### writeString

    public void writeString(java.lang.String x,
                   int len)
                     throws java.sql.SQLException

Write the next attribute to the stream as a Java String.

Specified by:
  `writeString` in interface `IfmxUDTSQLOutput`
Specified by:
  `writeString` in interface `SQLUDTOutput`
Parameters:
  `x` - the value to pass to the database.
  `len` - the length of the destinated field
Throws:
  `java.sql.SQLException`

#### writeString

    public void writeString(java.lang.String x,
                   java.lang.String dbEnc)
                     throws java.sql.SQLException

Write the string to the stream with dbencoding.

Parameters:
  `x` - the value to write to the stream
  `dbenc` - is the database encoding
Throws:
  `java.sql.SQLException`

#### writeByte

    public void writeByte(byte x)
                   throws java.sql.SQLException

Write the next attribute to the stream as a Java byte.

Specified by:
  `writeByte` in interface `java.sql.SQLOutput`
Parameters:
  `x` - the value to pass to the database.
Throws:
  `java.sql.SQLException`

#### writeBoolean

    public void writeBoolean(boolean x)
                      throws java.sql.SQLException

Write the next attribute to the stream as a Java boolean.

Specified by:
  `writeBoolean` in interface `java.sql.SQLOutput`
Parameters:
  `x` - the value to pass to the database.
Throws:
  `java.sql.SQLException`

#### writeShort

    public void writeShort(short x)
                    throws java.sql.SQLException

Write the next attribute to the stream as a Java short.

Specified by:
  `writeShort` in interface `java.sql.SQLOutput`
Parameters:
  `x` - the value to pass to the database.
Throws:
  `java.sql.SQLException`

#### writeInt

    public void writeInt(int x)
                  throws java.sql.SQLException

Write the next attribute to the stream as a Java int.

Specified by:
  `writeInt` in interface `java.sql.SQLOutput`
Parameters:
  `x` - the value to pass to the database.
Throws:
  `java.sql.SQLException`

#### writeLong

    public void writeLong(long x)
                   throws java.sql.SQLException

Write the next attribute to the stream as a Java long.

Specified by:
  `writeLong` in interface `java.sql.SQLOutput`
Parameters:
  `x` - the value to pass to the database.
Throws:
  `java.sql.SQLException`

#### writeLongBigint

    public void writeLongBigint(long x)
                         throws java.sql.SQLException

Throws:
  `java.sql.SQLException`

#### writeFloat

    public void writeFloat(float x)
                    throws java.sql.SQLException

Write the next attribute to the stream as a Java float.

Specified by:
  `writeFloat` in interface `java.sql.SQLOutput`
Parameters:
  `x` - the value to pass to the database.
Throws:
  `java.sql.SQLException`

#### writeDouble

    public void writeDouble(double x)
                     throws java.sql.SQLException

Write the next attribute to the stream as a Java double.

Specified by:
  `writeDouble` in interface `java.sql.SQLOutput`
Parameters:
  `x` - the value to pass to the database.
Throws:
  `java.sql.SQLException`

#### writeBigDecimal

    public void writeBigDecimal(java.math.BigDecimal x)
                         throws java.sql.SQLException

Write the next attribute to the stream as a java.math.BigDecimal object.

Specified by:
  `writeBigDecimal` in interface `java.sql.SQLOutput`
Parameters:
  `x` - the value to pass to the database.
Throws:
  `java.sql.SQLException`

#### writeBytes

    public void writeBytes(byte[] x,
                  int len)
                    throws java.sql.SQLException

Description copied from interface: `SQLUDTOutput`
Write the next attribute to the stream as a Java byte array. This method is similar to SQLOutput.writeBytes() with the exception that a fixed length of data is written to the stream. If the array passed in is shorter then the destinated length, the driver will zero pad the array. This method replaces SQLOutput.writeBytes() in the UDT implementation since the user defined type is unknown to the driver, the user MUST supply a length in order for the driver to write the next attribute properly.

Specified by:
  `writeBytes` in interface `IfmxUDTSQLOutput`
Specified by:
  `writeBytes` in interface `SQLUDTOutput`
Parameters:
  `x` - The value to be passed to the database.
  `len` - the length of the destinated field
Throws:
  `java.sql.SQLException`

#### writeTimestamp

    public void writeTimestamp(java.sql.Timestamp x)
                        throws java.sql.SQLException

Write the next attribute to the stream as a java.sql.Timestamp object. Timestamp is mapped to mi_datetime and is stored as dtime_t as defined in datetime.h. It's basically a short qualifier followed by a dec_t.

Specified by:
  `writeTimestamp` in interface `java.sql.SQLOutput`
Parameters:
  `x` - the value to pass to the database.
Throws:
  `java.sql.SQLException`

#### writeCharacterStream

    public void writeCharacterStream(java.io.Reader x)
                              throws java.sql.SQLException

Return the next attribute to the stream as a stream of Unicode characters.

Specified by:
  `writeCharacterStream` in interface `java.sql.SQLOutput`
Parameters:
  `x` - the value to pass to the database.
Throws:
  `java.sql.SQLException`

#### writeAsciiStream

    public void writeAsciiStream(java.io.InputStream x)
                          throws java.sql.SQLException

Return the next attribute to the stream as a stream of ASCII characters.

Specified by:
  `writeAsciiStream` in interface `java.sql.SQLOutput`
Parameters:
  `x` - the value to pass to the database.
Throws:
  `java.sql.SQLException`

#### writeBinaryStream

    public void writeBinaryStream(java.io.InputStream x)
                           throws java.sql.SQLException

Return the next attribute to the stream as a stream of uninterpreted bytes.

Specified by:
  `writeBinaryStream` in interface `java.sql.SQLOutput`
Parameters:
  `x` - the value to pass to the database.
Throws:
  `java.sql.SQLException`

#### writeObject

    public void writeObject(java.sql.SQLData x)
                     throws java.sql.SQLException

Write to the stream the data contained in the given object. When @x is null, the method writes an SQL NULL to the stream. Otherwise, it calls the SQLData.writeSQL method of the @x, which writes to the stream using the protocol described for SQLData.writeSQL.

Specified by:
  `writeObject` in interface `java.sql.SQLOutput`
Parameters:
  `x` - the object representing data of an SQL structured or distinct type
Throws:
  `java.sql.SQLException`

#### writeRef

    public void writeRef(java.sql.Ref x)
                  throws java.sql.SQLException

Write a REF(<structured-type>) to the stream.

Specified by:
  `writeRef` in interface `java.sql.SQLOutput`
Parameters:
  `x` - an object representing data of an SQL REF Type
Throws:
  `java.sql.SQLException`

#### writeBlob

    public void writeBlob(java.sql.Blob x)
                   throws java.sql.SQLException

Write a BLOB to the stream.

Specified by:
  `writeBlob` in interface `java.sql.SQLOutput`
Parameters:
  `x` - an object representing a BLOB
Throws:
  `java.sql.SQLException`

#### writeClob

    public void writeClob(java.sql.Clob x)
                   throws java.sql.SQLException

Write a CLOB to the stream.

Specified by:
  `writeClob` in interface `java.sql.SQLOutput`
Parameters:
  `x` - an object representing a CLOB
Throws:
  `java.sql.SQLException`

#### writeStruct

    public void writeStruct(java.sql.Struct x)
                     throws java.sql.SQLException

Write a structured-type to the stream.

Specified by:
  `writeStruct` in interface `java.sql.SQLOutput`
Parameters:
  `x` - an object representing data of a Structured Type
Throws:
  `java.sql.SQLException`

#### writeArray

    public void writeArray(java.sql.Array x)
                    throws java.sql.SQLException

Write an array to the stream.

Specified by:
  `writeArray` in interface `java.sql.SQLOutput`
Parameters:
  `x` - an object representing an SQL array
Throws:
  `java.sql.SQLException`

#### writeInterval

    public void writeInterval(Interval x)
                       throws java.sql.SQLException

Write the next attribute to the stream as a Interval object (IntervalYM or IntervalDF). Interval is mapped to mi_interval and is stored as intrvl_t as defined in datetime.h. It's basically a short qualifier followed by a dec_t.

Specified by:
  `writeInterval` in interface `IfmxUDTSQLOutput`
Specified by:
  `writeInterval` in interface `SQLUDTOutput`
Parameters:
  `x` - the interval to pass to the database.
Throws:
  `java.sql.SQLException`

#### length

    public int length()

Description copied from interface: `IfmxUDTSQLOutput`

Gets the total length written to the data stream.

Specified by:
  `length` in interface `IfmxUDTSQLOutput`
Returns:
  The total length.

#### setAutoAlignment

    public void setAutoAlignment(boolean value)

Enable or disable automatic alignment. The default is that the driver automatically handles alignment between data fields.

Specified by:
  `setAutoAlignment` in interface `IfmxUDTSQLOutput`
Parameters:
  `value` - = true then alignment should be handles automatically. If value = false then no alignment is done. It's the user's respon- sibility to call skipBytes(int) to handle alignment.

#### getAutoAlignment

    public boolean getAutoAlignment()

Returns true if auto alignment is enabled and false if auto alignment has been disabled.

Specified by:
  `getAutoAlignment` in interface `IfmxUDTSQLOutput`
Returns:
  true if auto alignment is enabled.

#### skipBytes

    public void skipBytes(int len)
                   throws java.sql.SQLException

Skips over and discards len bytes of data from the output stream. alignment has been disabled.

Specified by:
  `skipBytes` in interface `IfmxUDTSQLOutput`
Parameters:
  `len` - Number of bytes to skip over and discard.
Throws:
  `java.sql.SQLException`

#### getCurrentPosition

    public int getCurrentPosition()

Returns the current position in the output stream.

Specified by:
  `getCurrentPosition` in interface `IfmxUDTSQLOutput`
Returns:
  Returns the current position.

#### setCurrentPosition

    public void setCurrentPosition(int position)
                            throws java.sql.SQLException

Resets the current position.

Specified by:
  `setCurrentPosition` in interface `IfmxUDTSQLOutput`
Parameters:
  `position` -
Throws:
  `java.sql.SQLException`

#### available

    public int available()

Returns the number of valid bytes remaining in this output stream. This will always return 0 unless the user has called setCurrentPosition().

Specified by:
  `available` in interface `IfmxUDTSQLOutput`
Returns:
  Returns the number of bytes available in the output stream

#### getUDTInfo

    public IfxUDTInfo getUDTInfo(int xid)
                          throws java.sql.SQLException

Get general information about opaque and distinct types and detailed information for complex types. Calls IfmxConnection.getUDTInfo(int) param xid Is the extended id found in sysxtdtype system catalog.

Specified by:
  `getUDTInfo` in interface `IfmxUDTSQLOutput`
Parameters:
  `xid` - Is the extended id found in sysxtdtype system catalog.
Returns:
  The detailed type information as an Informix IfxUDTInfo.
Throws:
  `java.sql.SQLException`

#### getUDTInfo

    public IfxUDTInfo getUDTInfo(java.lang.String name,
                        java.lang.String owner)
                          throws java.sql.SQLException

Get general information about opaque and distinct types and detailed information for complex types. Calls IfmxConnection.getUDTInfo(String name, String owner)

Specified by:
  `getUDTInfo` in interface `IfmxUDTSQLOutput`
Parameters:
  `name` - The data type name.
  `owner` - The owner of the data type (can be null).
Returns:
  The detailed type information as an Informix IfxUDTInfo.
Throws:
  `java.sql.SQLException`

#### writeURL

    public void writeURL(java.net.URL x)
                  throws java.sql.SQLException

Specified by:
  `writeURL` in interface `java.sql.SQLOutput`
Throws:
  `java.sql.SQLException`

#### writeNClob

    public void writeNClob(java.sql.NClob x)
                    throws java.sql.SQLException

Specified by:
  `writeNClob` in interface `java.sql.SQLOutput`
Throws:
  `java.sql.SQLException`

#### writeNString

    public void writeNString(java.lang.String x)
                      throws java.sql.SQLException

Specified by:
  `writeNString` in interface `java.sql.SQLOutput`
Throws:
  `java.sql.SQLException`

#### writeRowId

    public void writeRowId(java.sql.RowId x)
                    throws java.sql.SQLException

Specified by:
  `writeRowId` in interface `java.sql.SQLOutput`
Throws:
  `java.sql.SQLException`

#### writeSQLXML

    public void writeSQLXML(java.sql.SQLXML x)
                     throws java.sql.SQLException

Specified by:
  `writeSQLXML` in interface `java.sql.SQLOutput`
Throws:
  `java.sql.SQLException`

#### toByteArray

    public byte[] toByteArray()

#### writeString

    public void writeString(java.lang.String x)
                     throws java.sql.SQLException

Write the next attribute to the stream as a Java String.

Specified by:
  `writeString` in interface `java.sql.SQLOutput`
Parameters:
  `x` - the value to pass to the database.
Throws:
  `java.sql.SQLException`

#### writeBytes

    public void writeBytes(byte[] x)
                    throws java.sql.SQLException

Write the next attribute to the stream as an array of bytes.

Specified by:
  `writeBytes` in interface `java.sql.SQLOutput`
Parameters:
  `x` - the value to pass to the database.
Throws:
  `java.sql.SQLException`

#### writeDate

    public void writeDate(java.sql.Date x)
                   throws java.sql.SQLException

Write the next attribute to the stream as a java.sql.Date object.

Specified by:
  `writeDate` in interface `java.sql.SQLOutput`
Parameters:
  `x` - the value to pass to the database.
Throws:
  `java.sql.SQLException`

#### writeTime

    public void writeTime(java.sql.Time x)
                   throws java.sql.SQLException

Write the next attribute to the stream as a java.sql.Time object.

Specified by:
  `writeTime` in interface `java.sql.SQLOutput`
Parameters:
  `x` - the value to pass to the database.
Throws:
  `java.sql.SQLException`