javax.sql.rowset.serial
Class SerialClob

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.sql.rowset.serial.SerialClob
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable , Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable , Clob sample code for java.sql.Clob definition code for java.sql.Clob

public class SerialClob
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements Clob sample code for java.sql.Clob definition code for java.sql.Clob , Serializable sample code for java.io.Serializable definition code for java.io.Serializable , Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable

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.

See Also:
Serialized Form

Constructor Summary
SerialClob sample code for javax.sql.rowset.serial.SerialClob.SerialClob(char[]) definition code for javax.sql.rowset.serial.SerialClob.SerialClob(char[]) (char[] ch)
          Constructs a SerialClob object that is a serialized version of the given char array.
SerialClob sample code for javax.sql.rowset.serial.SerialClob.SerialClob(java.sql.Clob) definition code for javax.sql.rowset.serial.SerialClob.SerialClob(java.sql.Clob) (Clob sample code for java.sql.Clob definition code for java.sql.Clob  clob)
          Constructs a SerialClob object that is a serialized version of the given Clob object.
 
Method Summary
 InputStream sample code for java.io.InputStream definition code for java.io.InputStream getAsciiStream sample code for javax.sql.rowset.serial.SerialClob.getAsciiStream() definition code for javax.sql.rowset.serial.SerialClob.getAsciiStream() ()
          Retrieves the CLOB value designated by this SerialClob object as an ascii stream.
 Reader sample code for java.io.Reader definition code for java.io.Reader getCharacterStream sample code for javax.sql.rowset.serial.SerialClob.getCharacterStream() definition code for javax.sql.rowset.serial.SerialClob.getCharacterStream() ()
          Returns this SerialClob object's data as a stream of Unicode characters.
 String sample code for java.lang.String definition code for java.lang.String getSubString sample code for javax.sql.rowset.serial.SerialClob.getSubString(long, int) definition code for javax.sql.rowset.serial.SerialClob.getSubString(long, int) (long pos, int length)
          Returns a copy of the substring contained in this SerialClob object, starting at the given position and continuing for the specified number or characters.
 long length sample code for javax.sql.rowset.serial.SerialClob.length() definition code for javax.sql.rowset.serial.SerialClob.length() ()
          Retrieves the number of characters in this SerialClob object's array of characters.
 long position sample code for javax.sql.rowset.serial.SerialClob.position(java.sql.Clob, long) definition code for javax.sql.rowset.serial.SerialClob.position(java.sql.Clob, long) (Clob sample code for java.sql.Clob definition code for java.sql.Clob  searchStr, long start)
          Returns the position in this SerialClob object where the given Clob signature begins, starting the search at the specified position.
 long position sample code for javax.sql.rowset.serial.SerialClob.position(java.lang.String, long) definition code for javax.sql.rowset.serial.SerialClob.position(java.lang.String, long) (String sample code for java.lang.String definition code for java.lang.String  searchStr, long start)
          Returns the position in this SerialClob object where the given String object begins, starting the search at the specified position.
 OutputStream sample code for java.io.OutputStream definition code for java.io.OutputStream setAsciiStream sample code for javax.sql.rowset.serial.SerialClob.setAsciiStream(long) definition code for javax.sql.rowset.serial.SerialClob.setAsciiStream(long) (long pos)
          Retrieves a stream to be used to write Ascii characters to the CLOB value that this SerialClob object represents, starting at position pos.
 Writer sample code for java.io.Writer definition code for java.io.Writer setCharacterStream sample code for javax.sql.rowset.serial.SerialClob.setCharacterStream(long) definition code for javax.sql.rowset.serial.SerialClob.setCharacterStream(long) (long pos)
          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.
 int setString sample code for javax.sql.rowset.serial.SerialClob.setString(long, java.lang.String) definition code for javax.sql.rowset.serial.SerialClob.setString(long, java.lang.String) (long pos, String sample code for java.lang.String definition code for java.lang.String  str)
          Writes the given Java String to the CLOB value that this SerialClob object represents, at the position pos.
 int setString sample code for javax.sql.rowset.serial.SerialClob.setString(long, java.lang.String, int, int) definition code for javax.sql.rowset.serial.SerialClob.setString(long, java.lang.String, int, int) (long pos, String sample code for java.lang.String definition code for java.lang.String  str, int offset, int length)
          Writes len characters of str, starting at character offset, to the CLOB value that this Clob represents.
 void truncate sample code for javax.sql.rowset.serial.SerialClob.truncate(long) definition code for javax.sql.rowset.serial.SerialClob.truncate(long) (long length)
          Truncates the CLOB value that this SerialClob object represents so that it has a length of len characters.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

SerialClob sample code for javax.sql.rowset.serial.SerialClob(char[]) definition code for javax.sql.rowset.serial.SerialClob(char[])

public SerialClob(char[] ch)
           throws SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException ,
                  SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
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 sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException - if an error occurs during serialization
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a SQL error occurs

SerialClob sample code for javax.sql.rowset.serial.SerialClob(java.sql.Clob) definition code for javax.sql.rowset.serial.SerialClob(java.sql.Clob)

public SerialClob(Clob sample code for java.sql.Clob definition code for java.sql.Clob  clob)
           throws SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException ,
                  SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
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 sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException - if an error occurs during serialization
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a SQL error occurs in capturing the CLOB; if the Clob object is a null; or if at least one of the Clob.getCharacterStream() and Clob.getAsciiStream() methods on the Clob return a null
See Also:
Clob sample code for java.sql.Clob definition code for java.sql.Clob
Method Detail

length sample code for javax.sql.rowset.serial.SerialClob.length() definition code for javax.sql.rowset.serial.SerialClob.length()

public long length()
            throws SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException 
Retrieves the number of characters in this SerialClob object's array of characters.

Specified by:
length sample code for java.sql.Clob.length() definition code for java.sql.Clob.length() in interface Clob sample code for java.sql.Clob definition code for java.sql.Clob
Returns:
a long indicating the length in characters of this SerialClob object's array of character
Throws:
SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException - if an error occurs

getCharacterStream sample code for javax.sql.rowset.serial.SerialClob.getCharacterStream() definition code for javax.sql.rowset.serial.SerialClob.getCharacterStream()

public Reader sample code for java.io.Reader definition code for java.io.Reader  getCharacterStream()
                          throws SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.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.

Specified by:
getCharacterStream sample code for java.sql.Clob.getCharacterStream() definition code for java.sql.Clob.getCharacterStream() in interface Clob sample code for java.sql.Clob definition code for java.sql.Clob
Returns:
a java.io.Reader object containing this SerialClob object's data
Throws:
SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException - if an error occurs
See Also:
Clob.setCharacterStream(long) sample code for java.sql.Clob.setCharacterStream(long) definition code for java.sql.Clob.setCharacterStream(long)

getAsciiStream sample code for javax.sql.rowset.serial.SerialClob.getAsciiStream() definition code for javax.sql.rowset.serial.SerialClob.getAsciiStream()

public InputStream sample code for java.io.InputStream definition code for java.io.InputStream  getAsciiStream()
                           throws SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException ,
                                  SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
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.

Specified by:
getAsciiStream sample code for java.sql.Clob.getAsciiStream() definition code for java.sql.Clob.getAsciiStream() in interface Clob sample code for java.sql.Clob definition code for java.sql.Clob
Returns:
a java.io.InputStream object containing this SerialClob object's data
Throws:
SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException - if this SerialClob object was not instantiated with a Clob object
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if there is an error accessing the CLOB value represented by the Clob object that was used to create this SerialClob object
See Also:
Clob.setAsciiStream(long) sample code for java.sql.Clob.setAsciiStream(long) definition code for java.sql.Clob.setAsciiStream(long)

getSubString sample code for javax.sql.rowset.serial.SerialClob.getSubString(long, int) definition code for javax.sql.rowset.serial.SerialClob.getSubString(long, int)

public String sample code for java.lang.String definition code for java.lang.String  getSubString(long pos,
                           int length)
                    throws SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.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.

Specified by:
getSubString sample code for java.sql.Clob.getSubString(long, int) definition code for java.sql.Clob.getSubString(long, int) in interface Clob sample code for java.sql.Clob definition code for java.sql.Clob
Parameters:
pos - the position of the first character in the substring to be copied; the first character of the SerialClob object is at position 1; must not be less than 1, and the sum of the starting position and the length of the substring must be less than the length of this SerialClob object
length - the number of characters in the substring to be returned; must not be greater than the length of this SerialClob object, and the sum of the starting position and the length of the substring must be less than the length of this SerialClob object
Returns:
a String object containing a substring of this SerialClob object beginning at the given position and containing the specified number of consecutive characters
Throws:
SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException - if either of the arguments is out of bounds

position sample code for javax.sql.rowset.serial.SerialClob.position(java.lang.String, long) definition code for javax.sql.rowset.serial.SerialClob.position(java.lang.String, long)

public long position(String sample code for java.lang.String definition code for java.lang.String  searchStr,
                     long start)
              throws SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException ,
                     SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
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.

Specified by:
position sample code for java.sql.Clob.position(java.lang.String, long) definition code for java.sql.Clob.position(java.lang.String, long) in interface Clob sample code for java.sql.Clob definition code for java.sql.Clob
Parameters:
searchStr - the String object for which to search
start - the position in this SerialClob object at which to start the search; the first position is 1; must not be less than 1 nor greater than the length of this SerialClob object
Returns:
the position at which the given String object begins, starting the search at the specified position; -1 if the given String object is not found or the starting position is out of bounds; position numbering for the return value starts at 1
Throws:
SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException - if an error occurs locating the String signature
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if there is an error accessing the Blob value from the database.

position sample code for javax.sql.rowset.serial.SerialClob.position(java.sql.Clob, long) definition code for javax.sql.rowset.serial.SerialClob.position(java.sql.Clob, long)

public long position(Clob sample code for java.sql.Clob definition code for java.sql.Clob  searchStr,
                     long start)
              throws SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException ,
                     SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
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.

Specified by:
position sample code for java.sql.Clob.position(java.sql.Clob, long) definition code for java.sql.Clob.position(java.sql.Clob, long) in interface Clob sample code for java.sql.Clob definition code for java.sql.Clob
Parameters:
searchStr - the Clob object for which to search
start - the position in this SerialClob object at which to begin the search; the first position is 1; must not be less than 1 nor greater than the length of this SerialClob object
Returns:
the position at which the given Clob object begins in this SerialClob object, at or after the specified starting position
Throws:
SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException - if an error occurs locating the Clob signature
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if there is an error accessing the Blob value from the database

setString sample code for javax.sql.rowset.serial.SerialClob.setString(long, java.lang.String) definition code for javax.sql.rowset.serial.SerialClob.setString(long, java.lang.String)

public int setString(long pos,
                     String sample code for java.lang.String definition code for java.lang.String  str)
              throws SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException 
Writes the given Java String to the CLOB value that this SerialClob object represents, at the position pos.

Specified by:
setString sample code for java.sql.Clob.setString(long, java.lang.String) definition code for java.sql.Clob.setString(long, java.lang.String) in interface Clob sample code for java.sql.Clob definition code for java.sql.Clob
Parameters:
pos - the position at which to start writing to the CLOB value that this SerialClob object represents; the first position is 1; must not be less than 1 nor greater than the length of this SerialClob object
str - the string to be written to the CLOB value that this SerialClob object represents
Returns:
the number of characters written
Throws:
SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException - if there is an error accessing the CLOB value; if an invalid position is set; if an invalid offset value is set; if number of bytes to be written is greater than the SerialClob length; or the combined values of the length and offset is greater than the Clob buffer

setString sample code for javax.sql.rowset.serial.SerialClob.setString(long, java.lang.String, int, int) definition code for javax.sql.rowset.serial.SerialClob.setString(long, java.lang.String, int, int)

public int setString(long pos,
                     String sample code for java.lang.String definition code for java.lang.String  str,
                     int offset,
                     int length)
              throws SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException 
Writes len characters of str, starting at character offset, to the CLOB value that this Clob represents.

Specified by:
setString sample code for java.sql.Clob.setString(long, java.lang.String, int, int) definition code for java.sql.Clob.setString(long, java.lang.String, int, int) in interface Clob sample code for java.sql.Clob definition code for java.sql.Clob
Parameters:
pos - the position at which to start writing to the CLOB value that this SerialClob object represents; the first position is 1; must not be less than 1 nor greater than the length of this SerialClob object
str - the string to be written to the CLOB value that this Clob object represents
offset - the offset into str to start reading the characters to be written
length - the number of characters to be written
Returns:
the number of characters written
Throws:
SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException - if there is an error accessing the CLOB value; if an invalid position is set; if an invalid offset value is set; if number of bytes to be written is greater than the SerialClob length; or the combined values of the length and offset is greater than the Clob buffer

setAsciiStream sample code for javax.sql.rowset.serial.SerialClob.setAsciiStream(long) definition code for javax.sql.rowset.serial.SerialClob.setAsciiStream(long)

public OutputStream sample code for java.io.OutputStream definition code for java.io.OutputStream  setAsciiStream(long pos)
                            throws SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException ,
                                   SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
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.

Specified by:
setAsciiStream sample code for java.sql.Clob.setAsciiStream(long) definition code for java.sql.Clob.setAsciiStream(long) in interface Clob sample code for java.sql.Clob definition code for java.sql.Clob
Parameters:
pos - the position at which to start writing to the CLOB object
Returns:
the stream to which ASCII encoded characters can be written
Throws:
SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException - if SerialClob is not instantiated with a Clob object that supports setAsciiStream
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if there is an error accessing the CLOB value
See Also:
getAsciiStream() sample code for javax.sql.rowset.serial.SerialClob.getAsciiStream() definition code for javax.sql.rowset.serial.SerialClob.getAsciiStream()

setCharacterStream sample code for javax.sql.rowset.serial.SerialClob.setCharacterStream(long) definition code for javax.sql.rowset.serial.SerialClob.setCharacterStream(long)

public Writer sample code for java.io.Writer definition code for java.io.Writer  setCharacterStream(long pos)
                          throws SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException ,
                                 SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
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.

Specified by:
setCharacterStream sample code for java.sql.Clob.setCharacterStream(long) definition code for java.sql.Clob.setCharacterStream(long) in interface Clob sample code for java.sql.Clob definition code for java.sql.Clob
Parameters:
pos - the position at which to start writing to the CLOB value
Returns:
a stream to which Unicode encoded characters can be written
Throws:
SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException - if the SerialClob is not instantiated with a Clob object that supports setCharacterStream
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if there is an error accessing the CLOB value
See Also:
getCharacterStream() sample code for javax.sql.rowset.serial.SerialClob.getCharacterStream() definition code for javax.sql.rowset.serial.SerialClob.getCharacterStream()

truncate sample code for javax.sql.rowset.serial.SerialClob.truncate(long) definition code for javax.sql.rowset.serial.SerialClob.truncate(long)

public void truncate(long length)
              throws SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.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.

Specified by:
truncate sample code for java.sql.Clob.truncate(long) definition code for java.sql.Clob.truncate(long) in interface Clob sample code for java.sql.Clob definition code for java.sql.Clob
Parameters:
length - the length, in bytes, to which the CLOB value should be truncated
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if there is an error accessing the CLOB value
SerialException sample code for javax.sql.rowset.serial.SerialException definition code for javax.sql.rowset.serial.SerialException