Android
java.sql
public interface

java.sql.Clob

java.sql.Clob

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

          InputStream  getAsciiStream()
Gets the value of this Clob object as an ASCII stream.
          Reader  getCharacterStream()
Gets the value of this Clob object as a java.io.Reader.
          String  getSubString(long pos, int length)
Gets a copy of a specified substring in this Clob.
          long  length()
Retrieves the number of characters in this Clob object.
          long  position(String searchstr, long start)
Retrieves the character position at which a specified substring appears in this Clob object.
          long  position(Clob searchstr, long start)
Retrieves the character position at which a specified Clob object appears in this Clob object.
          OutputStream  setAsciiStream(long pos)
Retrieves a stream which can be used to write Ascii characters to this Clob object, starting at specified position.
          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.
          int  setString(long pos, String str)
Writes a given Java String to this Clob object at a specified position.
          int  setString(long pos, String str, int offset, int len)
Writes len characters of String, starting at a specified character offset, to this Clob.
          void  truncate(long len)
Truncates this Clob to have a specified length of characters.

Details

Public Methods

public InputStream getAsciiStream()

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

Returns

  • an ASCII InputStream giving access to the Clob data

Throws

SQLException if an error occurs accessing the Clob

public Reader getCharacterStream()

Gets the value of this Clob object as a java.io.Reader.

Returns

  • a character stream Reader object giving access to the Clob data

Throws

SQLException if an error occurs accessing the Clob

public String getSubString(long pos, int length)

Gets a copy of a specified substring in this Clob.

Parameters

pos the index of the start of the substring in the Clob
length the length of the data to retrieve

Returns

  • A String containing the requested data

Throws

SQLException if an error occurs accessing the Clob

public long length()

Retrieves the number of characters in this Clob object.

Returns

  • a long value with the number of character in this Clob.

Throws

SQLException if an error occurs accessing the Clob

public long position(String searchstr, long start)

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

Parameters

searchstr th String to search for
start the position at which to start the search within this Clob.

Returns

  • 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 long position(Clob searchstr, long start)

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

Parameters

searchstr the specified Clob to search for
start the position within this Clob to start the search

Returns

  • 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 OutputStream setAsciiStream(long pos)

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

Parameters

pos the position at which to start the writing

Returns

  • an OutputStream which can be used to write ASCII characters to this Clob.

Throws

SQLException if an error occurs accessing the Clob

public 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.

Parameters

pos the position at which to start the writing

Returns

  • a Writer which can be used to write Unicode characters to this Clob.

Throws

SQLException if an error occurs accessing the Clob

public int setString(long pos, String str)

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

Parameters

pos the position at which to start the writing
str the String to write

Returns

  • the number of characters written

Throws

SQLException if an error occurs accessing the Clob

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

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

Parameters

pos the position at which to start the writing
str the String to write
offset the offset within str to start writing from
len the number of characters to write

Returns

  • the number of characters written

Throws

SQLException if an error occurs accessing the Clob

public void truncate(long len)

Truncates this Clob to have a specified length of characters.

Parameters

len the length in characters to truncate this Clob

Throws

SQLException if an error occurs accessing the Clob
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56