| |
|
| java.lang.Object javax.sql.rowset.serial.SerialClob
SerialClob | public class SerialClob implements Clob,Serializable,Cloneable(Code) | | 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.
author: Jonathan Bruce |
Field Summary | |
final static long | serialVersionUID The identifier that assists in the serialization of this SerialClob
object. |
Constructor Summary | |
public | SerialClob(char ch) Constructs a SerialClob object that is a serialized version of
the given char array. | public | SerialClob(Clob clob) 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. |
Method Summary | |
public void | free() | public java.io.InputStream | getAsciiStream() Retrieves the CLOB value designated by this SerialClob
object as an ascii stream. | public java.io.Reader | getCharacterStream() Returns this SerialClob object's data as a stream
of Unicode characters. | public Reader | getCharacterStream(long pos, long length) | public String | getSubString(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. | public long | length() Retrieves the number of characters in this SerialClob
object's array of characters. | public long | position(String searchStr, long start) Returns the position in this SerialClob object
where the given String object begins, starting
the search at the specified position. | public long | position(Clob searchStr, long start) Returns the position in this SerialClob object
where the given Clob signature begins, starting
the search at the specified position. | public java.io.OutputStream | setAsciiStream(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 . | public java.io.Writer | setCharacterStream(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 . | public int | setString(long pos, String str) 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) Writes len characters of str , starting
at character offset , to the CLOB value
that this Clob represents. | public void | truncate(long length) Truncates the CLOB value that this SerialClob
object represents so that it has a length of len
characters. |
serialVersionUID | final static long serialVersionUID(Code) | | The identifier that assists in the serialization of this SerialClob
object.
|
SerialClob | public SerialClob(char ch) throws SerialException, SQLException(Code) | | 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 beserialized throws: SerialException - if an error occurs during serialization throws: SQLException - if a SQL error occurs |
SerialClob | public SerialClob(Clob clob) throws SerialException, SQLException(Code) | | 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 thisSerialClob object is to be constructed; cannot be null throws: SerialException - if an error occurs during serialization throws: 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 See Also: java.sql.Clob |
getAsciiStream | public java.io.InputStream getAsciiStream() throws SerialException, SQLException(Code) | | 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.
a java.io.InputStream object containingthis SerialClob object's data throws: SerialException - if this SerialClob object was not instantiatedwith a Clob object throws: SQLException - if there is an error accessing the CLOB value represented by the Clob object that wasused to create this SerialClob object |
getCharacterStream | public java.io.Reader getCharacterStream() throws SerialException(Code) | | 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.
a java.io.Reader object containing thisSerialClob object's data throws: SerialException - if an error occurs |
getSubString | public String getSubString(long pos, int length) throws SerialException(Code) | | Returns a copy of the substring contained in this
SerialClob object, starting at the given position
and continuing for the specified number or characters.
Parameters: pos - the position of the first character in the substringto be copied; the first character of theSerialClob object is at position1 ; must not be less than 1 ,and the sum of the starting position and the lengthof the substring must be less than the length of thisSerialClob object Parameters: length - the number of characters in the substring to bereturned; must not be greater than the length ofthis SerialClob object, and thesum of the starting position and the lengthof the substring must be less than the length of thisSerialClob object a String object containing a substring ofthis SerialClob object beginning at thegiven position and containing the specified number ofconsecutive characters throws: SerialException - if either of the arguments is out of bounds |
length | public long length() throws SerialException(Code) | | Retrieves the number of characters in this SerialClob
object's array of characters.
a long indicating the length in characters of thisSerialClob object's array of character throws: SerialException - if an error occurs |
position | public long position(String searchStr, long start) throws SerialException, SQLException(Code) | | 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.
Parameters: searchStr - the String object for which tosearch Parameters: start - the position in this SerialClob objectat which to start the search; the first position is1 ; must not be less than 1 norgreater than the length of this SerialClob object the position at which the given String objectbegins, starting the search at the specified position;-1 if the given String object isnot found or the starting position is out of bounds; positionnumbering for the return value starts at 1 throws: SerialException - if an error occurs locating the String signature throws: SQLException - if there is an error accessing the Blob value from the database. |
position | public long position(Clob searchStr, long start) throws SerialException, SQLException(Code) | | 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.
Parameters: searchStr - the Clob object for which to search Parameters: start - the position in this SerialClob objectat which to begin the search; the first position is1 ; must not be less than 1 norgreater than the length of this SerialClob object the position at which the given Clob object begins in this SerialClob object,at or after the specified starting position throws: SerialException - if an error occurs locating the Clob signature throws: SQLException - if there is an error accessing the Blob value from the database |
setAsciiStream | public java.io.OutputStream setAsciiStream(long pos) throws SerialException, SQLException(Code) | | 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.
Parameters: pos - the position at which to start writing to theCLOB object the stream to which ASCII encoded characters can be written throws: SerialException - if SerialClob is not instantiated with aClob object that supports setAsciiStream throws: SQLException - if there is an error accessing the CLOB value See Also: SerialClob.getAsciiStream |
setCharacterStream | public java.io.Writer setCharacterStream(long pos) throws SerialException, SQLException(Code) | | 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.
Parameters: pos - the position at which to start writing to theCLOB value a stream to which Unicode encoded characters can be written throws: SerialException - if the SerialClob is not instantiated witha Clob object that supports setCharacterStream throws: SQLException - if there is an error accessing the CLOB value See Also: SerialClob.getCharacterStream |
setString | public int setString(long pos, String str) throws SerialException(Code) | | Writes the given Java String to the CLOB
value that this SerialClob object represents, at the position
pos .
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 norgreater than the length of this SerialClob object Parameters: str - the string to be written to the CLOB value that this SerialClob object represents the number of characters written throws: 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 writtenis greater than the SerialClob length; or the combinedvalues of the length and offset is greater than the Clob buffer |
setString | public int setString(long pos, String str, int offset, int length) throws SerialException(Code) | | Writes len characters of str , starting
at character offset , to the CLOB value
that this Clob represents.
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 norgreater than the length of this SerialClob object Parameters: str - the string to be written to the CLOB value that this Clob object represents Parameters: offset - the offset into str to start readingthe characters to be written Parameters: length - the number of characters to be written the number of characters written throws: 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 writtenis greater than the SerialClob length; or the combinedvalues of the length and offset is greater than the Clob buffer |
truncate | public void truncate(long length) throws SerialException(Code) | | 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.
Parameters: length - the length, in bytes, to which the CLOB value should be truncated throws: SQLException - if there is an error accessing the CLOB value |
|
|
|