public class ClobImpl extends Object implements Clob
CLOB
type.
An SQL CLOB
is a built-in type that stores a Character Large Object as a column value
in a row of a database table. By default drivers implement a Clob
object using an SQL
locator(CLOB)
, which means that a Clob
object contains a logical pointer to the
SQL CLOB
data rather than the data itself. A Clob
object is valid for the duration
of the transaction in which it was created.
The Clob
interface provides methods for getting the length of an SQL CLOB
(Character Large Object) value, for materializing a CLOB
value on the client, and for
searching for a substring or CLOB
object within a CLOB
value.
Methods in the interfaces ResultSet
, CallableStatement
, and PreparedStatement
, such as
getClob
and setClob
allow a programmer to access an SQL CLOB
value.
In addition, this interface has methods for updating a CLOB
value.
Constructor and Description |
---|
ClobImpl(String string)
Constructor taking a string.
|
Modifier and Type | Method and Description |
---|---|
void |
free()
Free the Blob object and releases the resources that it holds.
|
InputStream |
getAsciiStream() |
Reader |
getCharacterStream() |
Reader |
getCharacterStream(long pos,
long length)
Returns a Reader object that contains a partial Clob value, starting with the character specified by pos,
which is length characters in length.
|
String |
getSubString(long pos,
int length) |
long |
length() |
long |
position(Clob searchstr,
long start) |
long |
position(String searchstr,
long start) |
OutputStream |
setAsciiStream(long pos) |
Writer |
setCharacterStream(long pos) |
int |
setString(long pos,
String str) |
int |
setString(long pos,
String str,
int offset,
int len) |
void |
truncate(long len) |
public ClobImpl(String string) throws IOException
string
- The string.IOException
- if an error occurspublic long length() throws SQLException
length
in interface Clob
SQLException
public void truncate(long len) throws SQLException
truncate
in interface Clob
SQLException
public InputStream getAsciiStream() throws SQLException
getAsciiStream
in interface Clob
SQLException
public OutputStream setAsciiStream(long pos) throws SQLException
setAsciiStream
in interface Clob
SQLException
public Reader getCharacterStream() throws SQLException
getCharacterStream
in interface Clob
SQLException
public Writer setCharacterStream(long pos) throws SQLException
setCharacterStream
in interface Clob
SQLException
public void free() throws SQLException
free
in interface Clob
SQLException
- if an error occurspublic Reader getCharacterStream(long pos, long length) throws SQLException
getCharacterStream
in interface Clob
pos
- the offset to the first byte of the partial value to be retrieved.
The first byte in the Clob is at position 1length
- the length in bytes of the partial value to be retrievedSQLException
public String getSubString(long pos, int length) throws SQLException
getSubString
in interface Clob
SQLException
public int setString(long pos, String str) throws SQLException
setString
in interface Clob
SQLException
public int setString(long pos, String str, int offset, int len) throws SQLException
setString
in interface Clob
SQLException
public long position(String searchstr, long start) throws SQLException
position
in interface Clob
SQLException
public long position(Clob searchstr, long start) throws SQLException
position
in interface Clob
SQLException
Copyright © 2015. All rights reserved.