Android APIs
Added in API level 1
public interface

Clob

java.sql.Clob
Known Indirect Subclasses

Class Overview

A Java interface mapping for the SQL CLOB type.

An SQL CLOB type stores a large array of characters as the value in a column of a database.

The java.sql.Clob interface provides methods for setting and retrieving data in the Clob, for querying Clob data length, for searching for data within the Clob.

Summary

Public Methods
abstract void free()
Frees any resources held by this clob.
abstract InputStream getAsciiStream()
Gets the value of this Clob object as an ASCII stream.
abstract Reader getCharacterStream()
Gets the data of this Clob object in a java.io.Reader.
abstract Reader getCharacterStream(long pos, long length)
Returns a Reader that reads length characters from this clob, starting at 1-based offset {code pos}.
abstract String getSubString(long pos, int length)
Gets a copy of a specified substring in this Clob.
abstract long length()
Retrieves the number of characters in this Clob object.
abstract long position(String searchstr, long start)
Retrieves the character position at which a specified substring appears in this Clob object.
abstract long position(Clob searchstr, long start)
Retrieves the character position at which a specified Clob object appears in this Clob object.
abstract OutputStream setAsciiStream(long pos)
Retrieves a stream which can be used to write Ascii characters to this Clob object, starting at specified position.
abstract Writer setCharacterStream(long pos)
Retrieves a stream which can be used to write a stream of unicode characters to this Clob object, at a specified position.
abstract int setString(long pos, String str)
Writes a given Java String to this Clob object at a specified position.
abstract int setString(long pos, String str, int offset, int len)
Writes len characters of a string, starting at a specified character offset, to this Clob.
abstract void truncate(long len)
Truncates this Clob after the specified number of characters.

Public Methods

public abstract void free ()

Added in API level 9

Frees any resources held by this clob. After free is called, calling method other than free will throw SQLException (calling free repeatedly will do nothing).

Throws
SQLException

public abstract InputStream getAsciiStream ()

Added in API level 1

Gets the value of this Clob object as an ASCII stream.

Returns
InputStream an ASCII InputStream giving access to the Clob data.
Throws
SQLException if an error occurs accessing the Clob.

public abstract Reader getCharacterStream ()

Added in API level 1

Gets the data of this Clob object in a java.io.Reader.

Returns
Reader a character stream Reader object giving access to the Clob data.
Throws
SQLException if an error occurs accessing the Clob.

public abstract Reader getCharacterStream (long pos, long length)

Added in API level 9

Returns a Reader that reads length characters from this clob, starting at 1-based offset {code pos}.

Parameters
pos long
length long
Returns
Reader
Throws
SQLException

public abstract String getSubString (long pos, int length)

Added in API level 1

Gets a copy of a specified substring in this Clob.

Parameters
pos long: the index of the start of the substring in the Clob.
length int: the length of the data to retrieve.
Returns
String A string containing the requested data.
Throws
SQLException if an error occurs accessing the Clob.

public abstract long length ()

Added in API level 1

Retrieves the number of characters in this Clob object.

Returns
long a long value with the number of character in this Clob.
Throws
SQLException if an error occurs accessing the Clob.

public abstract long position (String searchstr, long start)

Added in API level 1

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

Parameters
searchstr String: the string to search for.
start long: the position at which to start the search within this Clob.
Returns
long a long value with the position at which the specified string occurs within this Clob.
Throws
SQLException if an error occurs accessing the Clob.

public abstract long position (Clob searchstr, long start)

Added in API level 1

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

Parameters
searchstr Clob: the specified Clob to search for.
start long: the position within this Clob to start the search
Returns
long a long value with the position at which the specified Clob occurs within this Clob.
Throws
SQLException if an error occurs accessing the Clob.

public abstract OutputStream setAsciiStream (long pos)

Added in API level 1

Retrieves a stream which can be used to write Ascii characters to this Clob object, starting at specified position.

Parameters
pos long: the position at which to start the writing.
Returns
OutputStream an OutputStream which can be used to write ASCII characters to this Clob.
Throws
SQLException if an error occurs accessing the Clob.

public abstract Writer setCharacterStream (long pos)

Added in API level 1

Retrieves a stream which can be used to write a stream of unicode characters to this Clob object, at a specified position.

Parameters
pos long: the position at which to start the writing.
Returns
Writer a Writer which can be used to write unicode characters to this Clob.
Throws
SQLException if an error occurs accessing the Clob.

public abstract int setString (long pos, String str)

Added in API level 1

Writes a given Java String to this Clob object at a specified position.

Parameters
pos long: the position at which to start the writing.
str String: the string to write.
Returns
int the number of characters written.
Throws
SQLException if an error occurs accessing the Clob.

public abstract int setString (long pos, String str, int offset, int len)

Added in API level 1

Writes len characters of a string, starting at a specified character offset, to this Clob.

Parameters
pos long: the position at which to start the writing.
str String: the String to write.
offset int: the offset within str to start writing from.
len int: the number of characters to write.
Returns
int the number of characters written.
Throws
SQLException if an error occurs accessing the Clob.

public abstract void truncate (long len)

Added in API level 1

Truncates this Clob after the specified number of characters.

Parameters
len long: the length in characters giving the place to truncate this Clob.
Throws
SQLException if an error occurs accessing the Clob.