|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.sql.rowset.serial.SerialClob
public class SerialClob
A serializable 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.
| Constructor Summary | |
|---|---|
SerialClob(char[] ch)
Constructs a SerialClob that is serializable version of
a char[] array. |
|
SerialClob(java.sql.Clob clob)
Constructs a SerialClob object that is a serializable
version of the given Clob object. |
|
| Method Summary | |
|---|---|
java.io.InputStream |
getAsciiStream()
Retrieves a CLOB value designated by this SerialClob
object as an ascii stream. |
java.io.Reader |
getCharacterStream()
Returns this SerialClob object's data as a stream
of Unicode characters. |
java.lang.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. |
long |
length()
Retrieves the number of characters in this SerialClob
object's array of characters. |
long |
position(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(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. |
java.io.OutputStream |
setAsciiStream(long pos)
Retrieves a stream to be used to write Ascii characters to the CLOB value that this Clob object represents,
starting at position pos. |
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 Clob object
represents, at position pos. |
int |
setString(long pos,
java.lang.String str)
Writes the given Java String to the CLOB
value that this Clob object designates at the position
pos. |
int |
setString(long pos,
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(long length)
Truncates the CLOB value that this Clob
designates to have a length of len
characters. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SerialClob(char[] ch)
throws SerialException,
java.sql.SQLException
SerialClob that is serializable version of
a char[] array.
The new SerialClob is initialized with the data from the
char[] array, thus allowing disconnected RowSet
to establish serializable Clobs without touching the data source.
ch - the char array representing the Clob.
SerialException - if an error occurs during serialization
java.sql.SQLException - if a SQL errors occurs
public SerialClob(java.sql.Clob clob)
throws SerialException,
java.sql.SQLException
SerialClob object that is a serializable
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 Clob.getCharacterStream()
and Clob.getAsciiStream methods. SerialClob
cannot a serialize a Clob object in this instance - a
SQLException is thrown in this instance.
clob - the Clob object from which this
SerialClob object is to be constructed; cannot be null
SerialException - if an error occurs during serialization
java.sql.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 returns a nullClob| Method Detail |
|---|
public long length()
throws SerialException
SerialClob
object's array of characters.
length in interface java.sql.Cloblong indicating the length in characters of this
SerialClob object's array of character
SerialException - if an error occurs
public java.io.Reader getCharacterStream()
throws SerialException
SerialClob object's data as a stream
of Unicode characters. Unlike the related method, getAsciiStream,
a stream is produced regardless of whether the SerialClob
was created with a Clob object or a char[] array.
getCharacterStream in interface java.sql.Clobjava.io.Reader object containing this
SerialClob object's data
SerialException - if an error occurs
public java.io.InputStream getAsciiStream()
throws SerialException,
java.sql.SQLException
CLOB value designated by this SerialClob
object as an ascii stream. This method forwards the getAsciiStream()
call to the underlying Clob in the event that this
SerialClob object is instantiated with a Clob
object. If this SerialClob is instantiated with
a char[] array, a SerialException is thrown.
getAsciiStream in interface java.sql.Clobjava.io.InputStream object containing
this SerialClob object's data
SerialException - if this SerialClob is not instantiated
with a CLOB object that getAsciiStream method.
java.sql.SQLException - if there is an error accessing the
CLOB value
public java.lang.String getSubString(long pos,
int length)
throws SerialException
SerialClob object, starting at the given position
and continuing for the specified number or characters.
getSubString in interface java.sql.Clobpos - 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 objectlength - 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
String object containing a substring of
this SerialClob object beginning at the
given position and containing the specified number of
consecutive characters
SerialException - if either of the arguments is out of bounds
public long position(java.lang.String searchStr,
long start)
throws SerialException,
java.sql.SQLException
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.
position in interface java.sql.ClobsearchStr - the String object for which to
searchstart - 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
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
SerialException - if an error occurs locating the String signature
java.sql.SQLException - if there is an error accessing the Blob value
from the database.
public long position(java.sql.Clob searchStr,
long start)
throws SerialException,
java.sql.SQLException
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.
position in interface java.sql.ClobsearchStr - the Clob object for which to searchstart - 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
Clob
object begins in this SerialClob object,
at or after the specified starting position
SerialException - if an error occurs locating the Clob signature
java.sql.SQLException - if there is an error accessing the Blob value
from the database.
public int setString(long pos,
java.lang.String str)
throws SerialException
String to the CLOB
value that this Clob object designates at the position
pos.
setString in interface java.sql.Clobpos - 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 objectstr - the string to be written to the CLOB
value that this Clob designates
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
public int setString(long pos,
java.lang.String str,
int offset,
int length)
throws SerialException
len characters of str, starting
at character offset, to the CLOB value
that this Clob represents.
setString in interface java.sql.Clobpos - 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 objecstr - the string to be written to the CLOB
value that this Clob object representsoffset - the offset into str to start reading
the characters to be writtenlength - the number of characters to be written
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
public java.io.OutputStream setAsciiStream(long pos)
throws SerialException,
java.sql.SQLException
CLOB value that this Clob object represents,
starting at position pos. This method forwards the
setAsciiStream() call to the underlying Clob in
the event that this SerialClob object is instantiated with a
Clob. If this SerialClob is instantiated with
a char[] array, a SerialException is thrown.
setAsciiStream in interface java.sql.Clobpos - the position at which to start writing to this
CLOB object
SerialException - if SerialClob is not instantiated with a
Clob object that supports setAsciiStream
java.sql.SQLException - if there is an error accessing the
CLOB valuegetAsciiStream()
public java.io.Writer setCharacterStream(long pos)
throws SerialException,
java.sql.SQLException
CLOB value that this Clob object
represents, at position pos. This method forwards the
setCharacterStream() call to the underlying Clob in
the event that this SerialClob object is instantiated with a
Clob. If this SerialClob is instantiated with
a char[] array, a SerialException is thrown.
setCharacterStream in interface java.sql.Clobpos - the position at which to start writing to the
CLOB value
SerialException - if the SerialClob is not instantiated with
a Clob object that supports setCharacterStream()
java.sql.SQLException - if there is an error accessing the
CLOB valuegetCharacterStream()
public void truncate(long length)
throws SerialException
CLOB value that this Clob
designates to have a length of len
characters.
Truncating the SerialClob to length 0; has the affect of
clearing the SerialClob contents.
truncate in interface java.sql.Cloblength - the length, in bytes, to which the CLOB
value should be truncated
java.sql.SQLException - if there is an error accessing the
CLOB value
SerialException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||