Save This Page
Home » openjdk-7 » javax » sql » rowset » serial » [javadoc | source]
javax.sql.rowset.serial
public class: SerialClob [javadoc | source]
java.lang.Object
   javax.sql.rowset.serial.SerialClob

All Implemented Interfaces:
    Cloneable, Clob, Serializable

A serialized mapping in the Java programming language of an SQL CLOB value.

The SerialClob class provides a constructor for creating an instance from a Clob object. Note that the Clob object should have brought the SQL CLOB value's data over to the client before a SerialClob object is constructed from it. The data of an SQL CLOB value can be materialized on the client as a stream of Unicode characters.

SerialClob methods make it possible to get a substring from a SerialClob object or to locate the start of a pattern of characters.

Field Summary
static final  long serialVersionUID    The identifier that assists in the serialization of this SerialClob object. 
Constructor:
 public SerialClob(char[] ch) throws SQLException, SerialException 
    Constructs a SerialClob object that is a serialized version of the given char array.

    The new SerialClob object is initialized with the data from the char array, thus allowing disconnected RowSet objects to establish a serialized Clob object without touching the data source.

    Parameters:
    ch - the char array representing the Clob object to be serialized
    Throws:
    SerialException - if an error occurs during serialization
    SQLException - if a SQL error occurs
 public SerialClob(Clob clob) throws SQLException, SerialException 
    Constructs a SerialClob object that is a serialized version of the given Clob object.

    The new SerialClob object is initialized with the data from the Clob object; therefore, the Clob object should have previously brought the SQL CLOB value's data over to the client from the database. Otherwise, the new SerialClob object object will contain no data.

    Note: The Clob object supplied to this constructor cannot return null for the Clob.getCharacterStream() and Clob.getAsciiStream methods. This SerialClob constructor cannot serialize a Clob object in this instance and will throw an SQLException object.

    Parameters:
    clob - the Clob object from which this SerialClob object is to be constructed; cannot be null
    Throws:
    SerialException - if an error occurs during serialization
    SQLException - if a SQL error occurs in capturing the CLOB; if the Clob object is a null; or if both the Clob.getCharacterStream() and Clob.getAsciiStream() methods on the Clob return a null
    Also see:
    java.sql.Clob
Method from javax.sql.rowset.serial.SerialClob Summary:
free,   getAsciiStream,   getCharacterStream,   getCharacterStream,   getSubString,   length,   position,   position,   setAsciiStream,   setCharacterStream,   setString,   setString,   truncate
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.sql.rowset.serial.SerialClob Detail:
 public  void free() throws SQLException 
 public InputStream getAsciiStream() throws SQLException, SerialException 
    Retrieves the CLOB value designated by this SerialClob object as an ascii stream. This method forwards the getAsciiStream call to the underlying Clob object in the event that this SerialClob object is instantiated with a Clob object. If this SerialClob object is instantiated with a char array, a SerialException object is thrown.
 public Reader getCharacterStream() throws SerialException 
    Returns this SerialClob object's data as a stream of Unicode characters. Unlike the related method, getAsciiStream, a stream is produced regardless of whether the SerialClob object was created with a Clob object or a char array.
 public Reader getCharacterStream(long pos,
    long length) throws SQLException 
 public String getSubString(long pos,
    int length) throws SerialException 
    Returns a copy of the substring contained in this SerialClob object, starting at the given position and continuing for the specified number or characters.
 public long length() throws SerialException 
    Retrieves the number of characters in this SerialClob object's array of characters.
 public long position(String searchStr,
    long start) throws SQLException, SerialException 
    Returns the position in this SerialClob object where the given String object begins, starting the search at the specified position. This method returns -1 if the pattern is not found.
 public long position(Clob searchStr,
    long start) throws SQLException, SerialException 
    Returns the position in this SerialClob object where the given Clob signature begins, starting the search at the specified position. This method returns -1 if the pattern is not found.
 public OutputStream setAsciiStream(long pos) throws SQLException, SerialException 
    Retrieves a stream to be used to write Ascii characters to the CLOB value that this SerialClob object represents, starting at position pos. This method forwards the setAsciiStream() call to the underlying Clob object in the event that this SerialClob object is instantiated with a Clob object. If this SerialClob object is instantiated with a char array, a SerialException object is thrown.
 public Writer setCharacterStream(long pos) throws SQLException, SerialException 
    Retrieves a stream to be used to write a stream of Unicode characters to the CLOB value that this SerialClob object represents, at position pos. This method forwards the setCharacterStream() call to the underlying Clob object in the event that this SerialClob object is instantiated with a Clob object. If this SerialClob object is instantiated with a char array, a SerialException is thrown.
 public int setString(long pos,
    String str) throws SerialException 
    Writes the given Java String to the CLOB value that this SerialClob object represents, at the position pos.
 public int setString(long pos,
    String str,
    int offset,
    int length) throws SerialException 
    Writes len characters of str, starting at character offset, to the CLOB value that this Clob represents.
 public  void truncate(long length) throws SerialException 
    Truncates the CLOB value that this SerialClob object represents so that it has a length of len characters.

    Truncating a SerialClob object to length 0 has the effect of clearing its contents.