Top Description Fields Constructors Methods
org.hsqldb.jdbc

public Class JDBCClobClient

extends Object
implements Clob
Class Inheritance
All Implemented Interfaces
java.sql.Clob, java.lang.AutoCloseable
Imports
java.io.IOException, .InputStream, .OutputStream, .Reader, .Writer, java.sql.Clob, .SQLException, .SQLFeatureNotSupportedException, org.hsqldb.HsqlException, .SessionInterface, org.hsqldb.error.ErrorCode, org.hsqldb.types.ClobDataID, .ClobInputStream

A wrapper for HSQLDB ClobData objects. Instances of this class are returned by calls to ResultSet methods.
Author
Fred Toussi (fredt@users dot sourceforge.net)
Since
HSQLDB 1.9.0
Version
2.7.4

Field Summary

Modifier and TypeField and Description
pack-priv ClobDataID
pack-priv int
private boolean
private boolean
pack-priv ClobDataID
pack-priv JDBCResultSet
pack-priv SessionInterface

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
public synchronized void
public synchronized void
free()

Implements java.sql.Clob.free.

This method frees the Clob object and releases the resources that it holds.

public synchronized InputStream

Returns:

a java.io.InputStream object containing the CLOB data
getAsciiStream
()

Implements java.sql.Clob.getAsciiStream.

Retrieves the CLOB value designated by this Clob object as an ascii stream.

public synchronized Reader

Returns:

a java.io.Reader object containing the CLOB data
getCharacterStream
()

Implements java.sql.Clob.getCharacterStream.

Retrieves the CLOB value designated by this Clob object as a java.io.Reader object (or as a stream of characters).

public synchronized Reader

Returns:

Reader through which the partial Clob value can be read.
getCharacterStream
(long
the offset to the first character of the partial value to be retrieved. The first character in the Clob is at position 1.
pos
,
long
the length in characters of the partial value to be retrieved.
length
)

Implements java.sql.Clob.getCharacterStream.

Returns a Reader object that contains a partial Clob value, starting with the character specified by pos, which is length characters in length.

pack-priv char[]
getChars(long position, int length)

public ClobDataID
public synchronized String

Returns:

a String that is the specified substring in the CLOB value designated by this Clob object
getSubString
(long
the first character of the substring to be extracted. The first character is at position 1.
pos
,
int
the number of consecutive characters to be copied
length
)

Implements java.sql.Clob.getSubString.

Retrieves a copy of the specified substring in the CLOB value designated by this Clob object.

public synchronized boolean
pack-priv static boolean
isInLimits(long fullLength, long pos, long len)

public synchronized long

Returns:

length of the CLOB in characters
length
()

Implements java.sql.Clob.length.

Retrieves the number of characters in the CLOB value designated by this Clob object.

public synchronized long

Returns:

the position at which the substring appears or -1 if it is not present; the first position is 1
position
(String
the substring for which to search
searchstr
,
long
the position at which to begin searching; the first position is 1
start
)

Implements java.sql.Clob.position.

Retrieves the character position at which the specified substring searchstr appears in the SQL CLOB value represented by this Clob object.

public synchronized long

Returns:

the position at which the Clob object appears or -1 if it is not present; the first position is 1
position
(Clob
the Clob object for which to search
searchstr
,
long
the position at which to begin searching; the first position is 1
start
)

Implements java.sql.Clob.position.

Retrieves the character position at which the specified Clob object searchstr appears in this Clob object.

public synchronized OutputStream

Returns:

the stream to which ASCII encoded characters can be written
setAsciiStream
(final long
the position at which to start writing to this CLOB object
pos
)

Implements java.sql.Clob.setAsciiStream.

Retrieves a stream to be used to write Ascii characters to the CLOB value that this Clob object represents, starting at position pos.

public synchronized Writer

Returns:

a stream to which Unicode encoded characters can be written
setCharacterStream
(final long
the position at which to start writing to the CLOB value
pos
)

Implements java.sql.Clob.setCharacterStream.

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.

public synchronized int

Returns:

the number of characters written
setString
(long
the position at which to start writing to the CLOB value that this Clob object represents
pos
,
String
the string to be written to the CLOB value that this Clob designates
str
)

Implements java.sql.Clob.setString.

Writes the given Java String to the CLOB value that this Clob object designates at the position pos.

public synchronized int

Returns:

the number of characters written
setString
(long
the position at which to start writing to this CLOB object
pos
,
String
the string to be written to the CLOB value that this Clob object represents
str
,
int
the offset into str to start reading the characters to be written
offset
,
int
the number of characters to be written
len
)

Implements java.sql.Clob.setString.

Writes len characters of str, starting at character offset, to the CLOB value that this Clob represents.

public synchronized void
setWritable(JDBCResultSet result, int index)

private void
public synchronized void
truncate(long
the length, in bytes, to which the CLOB value should be truncated
len
)

Implements java.sql.Clob.truncate.

Truncates the CLOB value that this Clob designates to have a length of len characters.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

clobback to summary
pack-priv ClobDataID clob
colIndexback to summary
pack-priv int colIndex
isClosedback to summary
private boolean isClosed
isWritableback to summary
private boolean isWritable
originalClobback to summary
pack-priv ClobDataID originalClob
resultSetback to summary
pack-priv JDBCResultSet resultSet
sessionback to summary
pack-priv SessionInterface session

Constructor Detail

JDBCClobClientback to summary
public JDBCClobClient(SessionInterface session, ClobDataID clob)

Method Detail

checkClosedback to summary
private void checkClosed() throws SQLException
clearUpdatesback to summary
public synchronized void clearUpdates()
freeback to summary
public synchronized void free() throws SQLException

Implements java.sql.Clob.free.

This method frees the Clob object and releases the resources that it holds. The object is invalid once the free method is called.

After free has been called, any attempt to invoke a method other than free will result in a SQLException being thrown. If free is called multiple times, the subsequent calls to free are treated as a no-op.

Exceptions
SQLException:
if an error occurs releasing the Clob's resources
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
JDK 1.6, HSQLDB 2.0
getAsciiStreamback to summary
public synchronized InputStream getAsciiStream() throws SQLException

Implements java.sql.Clob.getAsciiStream.

Retrieves the CLOB value designated by this Clob object as an ascii stream. The ascii stream consists of the low ordre bytes of UTF-16 characters in the clob. The question mark character is returnd for UTF-16 characters beyond the range of 8-bit ASCII.

Returns:InputStream

a java.io.InputStream object containing the CLOB data

Exceptions
SQLException:
if there is an error accessing the CLOB value
getCharacterStreamback to summary
public synchronized Reader getCharacterStream() throws SQLException

Implements java.sql.Clob.getCharacterStream.

Retrieves the CLOB value designated by this Clob object as a java.io.Reader object (or as a stream of characters).

Returns:Reader

a java.io.Reader object containing the CLOB data

Exceptions
SQLException:
if there is an error accessing the CLOB value
getCharacterStreamback to summary
public synchronized Reader getCharacterStream(long pos, long length) throws SQLException

Implements java.sql.Clob.getCharacterStream.

Returns a Reader object that contains a partial Clob value, starting with the character specified by pos, which is length characters in length.

Parameters
pos:long

the offset to the first character of the partial value to be retrieved. The first character in the Clob is at position 1.

length:long

the length in characters of the partial value to be retrieved.

Returns:Reader

Reader through which the partial Clob value can be read.

Exceptions
SQLException:
if pos is less than 1 or if pos is greater than the number of characters in the Clob or if pos + length is greater than the number of characters in the Clob
SQLFeatureNotSupportedException:
if the JDBC driver does not support this method
Since
JDK 1.6, HSQLDB 2.0
getCharsback to summary
pack-priv char[] getChars(long position, int length) throws SQLException
getClobback to summary
public ClobDataID getClob()
getSubStringback to summary
public synchronized String getSubString(long pos, int length) throws SQLException

Implements java.sql.Clob.getSubString.

Retrieves a copy of the specified substring in the CLOB value designated by this Clob object.

Parameters
pos:long

the first character of the substring to be extracted. The first character is at position 1.

length:int

the number of consecutive characters to be copied

Returns:String

a String that is the specified substring in the CLOB value designated by this Clob object

Exceptions
SQLException:
if there is an error accessing the CLOB value
isClosedback to summary
public synchronized boolean isClosed()
isInLimitsback to summary
pack-priv static boolean isInLimits(long fullLength, long pos, long len)
lengthback to summary
public synchronized long length() throws SQLException

Implements java.sql.Clob.length.

Retrieves the number of characters in the CLOB value designated by this Clob object.

Returns:long

length of the CLOB in characters

Exceptions
SQLException:
if there is an error accessing the length of the CLOB value
positionback to summary
public synchronized long position(String searchstr, long start) throws SQLException

Implements java.sql.Clob.position.

Retrieves the character position at which the specified substring searchstr appears in the SQL CLOB value represented by this Clob object.

Parameters
searchstr:String

the substring for which to search

start:long

the position at which to begin searching; the first position is 1

Returns:long

the position at which the substring appears or -1 if it is not present; the first position is 1

Exceptions
SQLException:
if there is an error accessing the CLOB value
positionback to summary
public synchronized long position(Clob searchstr, long start) throws SQLException

Implements java.sql.Clob.position.

Retrieves the character position at which the specified Clob object searchstr appears in this Clob object.

Parameters
searchstr:Clob

the Clob object for which to search

start:long

the position at which to begin searching; the first position is 1

Returns:long

the position at which the Clob object appears or -1 if it is not present; the first position is 1

Exceptions
SQLException:
if there is an error accessing the CLOB value
setAsciiStreamback to summary
public synchronized OutputStream setAsciiStream(final long pos) throws SQLException

Implements java.sql.Clob.setAsciiStream.

Retrieves a stream to be used to write Ascii characters to the CLOB value that this Clob object represents, starting at position pos. The bytes written to the OutputStream are stored verbatim in the clob as the low order bytes of UTF-16 characters.

Parameters
pos:long

the position at which to start writing to this CLOB object

Returns:OutputStream

the stream to which ASCII encoded characters can be written

Exceptions
SQLException:
if there is an error accessing the CLOB value
setCharacterStreamback to summary
public synchronized Writer setCharacterStream(final long pos) throws SQLException

Implements java.sql.Clob.setCharacterStream.

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.

Parameters
pos:long

the position at which to start writing to the CLOB value

Returns:Writer

a stream to which Unicode encoded characters can be written

Exceptions
SQLException:
if there is an error accessing the CLOB value
setStringback to summary
public synchronized int setString(long pos, String str) throws SQLException

Implements java.sql.Clob.setString.

Writes the given Java String to the CLOB value that this Clob object designates at the position pos.

Parameters
pos:long

the position at which to start writing to the CLOB value that this Clob object represents

str:String

the string to be written to the CLOB value that this Clob designates

Returns:int

the number of characters written

Exceptions
SQLException:
if there is an error accessing the CLOB value
setStringback to summary
public synchronized int setString(long pos, String str, int offset, int len) throws SQLException

Implements java.sql.Clob.setString.

Writes len characters of str, starting at character offset, to the CLOB value that this Clob represents.

Parameters
pos:long

the position at which to start writing to this CLOB object

str:String

the string to be written to the CLOB value that this Clob object represents

offset:int

the offset into str to start reading the characters to be written

len:int

the number of characters to be written

Returns:int

the number of characters written

Exceptions
SQLException:
if there is an error accessing the CLOB value
setWritableback to summary
public synchronized void setWritable(JDBCResultSet result, int index)
startUpdateback to summary
private void startUpdate() throws SQLException
truncateback to summary
public synchronized void truncate(long len) throws SQLException

Implements java.sql.Clob.truncate.

Truncates the CLOB value that this Clob designates to have a length of len characters.

Parameters
len:long

the length, in bytes, to which the CLOB value should be truncated

Exceptions
SQLException:
if there is an error accessing the CLOB value