public interface Clob
A Clob object is a pointer to a character large object (CLOB) value in a table column. It is valid only during the transaction in which it was created. The corresponding SQL type is SQL CLOB.
getAsciiStream
public java.io.InputStream getAsciiStream() throws SQLException
This gets the CLOB’s content as a stream of ASCII bytes.
Returns: A stream containing the CLOB data. A SQLException is thrown if an error occurs while accessing this value.
getCharacterStream
public java.io.Reader getCharacterStream() throws SQLException
This gets the CLOB’s content as a Unicode character stream.
Returns: A Unicode character stream containing the CLOB data. A SQLException is thrown if an error occurs while accessing this value.
getSubString
public String getSubString(long pos, int length) throws SQLException
This gets a string of characters beginning at pos, containing length characters, from the original CLOB characters.
Parameters:
pos: | The index of the first character to return. The first character of the Clob object is at position 1. |
length: | The number of characters to be copied from the Clob object. |
Returns: A String that is the substring delimited by pos and length. A SQLException is thrown if an error occurs while accessing this value.
length
public long length() throws SQLException
This gets the number of characters in the CLOB value referenced by this Clob object.
Returns: The length of the CLOB in characters. A SQLException is thrown if an error occurs while accessing this value.
position
public long position(String searchstr, long start) throws SQLException
This searches for a position within the CLOB’s characters using a String as pattern. A starting point is provided. No wildcards are available.
Parameters:
searchstr: | The string to search in the CLOB. |
start: | The start position; the first character is at position 1. |
Returns: The position at which the pattern appears or -1 if the pattern isn’t found. A SQLException is thrown if an error occurs while accessing this value.
position
public long position(Clob searchstr, long start) throws SQLException
This searches for a position within the CLOB’s characters using another CLOB as a pattern. A starting point is provided. No wildcards are available.
Parameters:
searchstr: | The CLOB containing the characters to search in the current CLOB. |
start: | The start position; the first byte is at position 1. |
Returns: The position at which the pattern appears or -1 if the pattern isn’t found. A SQLException is thrown if an error occurs while accessing this value.
setAsciiStream
public java.io.OutputStream setAsciiStream(long pos) throws SQLException
This returns an output stream that can be used to write any number of ASCII characters to this CLOB at position pos.
Parameters:
pos: | The position in this CLOB object at which to start writing |
Returns: The output stream to which data can be written. A SQLException is thrown if an error occurs while accessing this value.
setCharacterStream
public java.io.Writer setCharacterStream(long pos) throws SQLException
This returns an output stream that can be used to write a stream of Unicode characters to this CLOB at position pos.
Parameters:
pos: | The position in this CLOB object at which to start writing |
Returns: The output stream to which data can be written. A SQLException is thrown if an error occurs while accessing this value.
setString
public int setString(long pos, String str) throws SQLException
This updates the CLOB’s characters using the string provided as a parameter. The characters are updated beginning at pos in the CLOB.
Parameters:
pos: | The position in the Clob object at which to start writing |
str: | The string to be written to this Clob object |
Returns: The number of bytes written to the clob object. A SQLException is thrown if an error occurs while accessing this value.
setString
public int setString(long pos, String str, int offset, int len) throws SQLException
This writes len characters of str, starting at position pos. A SQLException is thrown if an error occurs while accessing this value.
Parameters:
pos: | The position in the BLOB object at which to start writing |
str: | The string to be written to the CLOB object |
offset: | The offset into str to start reading the characters to be set |
len: | The number of characters to be written to this CLOB object |
Returns: The number of bytes written to the CLOB object. A SQLException is thrown if an error occurs while accessing this value.
truncate
public void truncate(long len) throws SQLException
This method is used to truncate the current CLOB to length len. A SQLException is thrown if an error occurs while accessing this value.
Parameters:
len: | The length, in bytes, to which the current BLOB must be truncated |