Class ClobImpl
- java.lang.Object
-
- org.datanucleus.store.rdbms.mapping.column.ClobImpl
-
- All Implemented Interfaces:
Clob
public class ClobImpl extends Object implements Clob
The mapping in the Java programming language for the SQLCLOB
type. An SQLCLOB
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 aClob
object using an SQLlocator(CLOB)
, which means that aClob
object contains a logical pointer to the SQLCLOB
data rather than the data itself. AClob
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 SQLCLOB
(Character Large Object) value, for materializing aCLOB
value on the client, and for searching for a substring orCLOB
object within aCLOB
value. Methods in the interfacesResultSet
,CallableStatement
, andPreparedStatement
, such asgetClob
andsetClob
allow a programmer to access an SQLCLOB
value. In addition, this interface has methods for updating aCLOB
value.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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(String searchstr, long start)
long
position(Clob 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)
-
-
-
Constructor Detail
-
ClobImpl
public ClobImpl(String string) throws IOException
Constructor taking a string.- Parameters:
string
- The string.- Throws:
IOException
- if an error occurs
-
-
Method Detail
-
length
public long length() throws SQLException
- Specified by:
length
in interfaceClob
- Throws:
SQLException
-
truncate
public void truncate(long len) throws SQLException
- Specified by:
truncate
in interfaceClob
- Throws:
SQLException
-
getAsciiStream
public InputStream getAsciiStream() throws SQLException
- Specified by:
getAsciiStream
in interfaceClob
- Throws:
SQLException
-
setAsciiStream
public OutputStream setAsciiStream(long pos) throws SQLException
- Specified by:
setAsciiStream
in interfaceClob
- Throws:
SQLException
-
getCharacterStream
public Reader getCharacterStream() throws SQLException
- Specified by:
getCharacterStream
in interfaceClob
- Throws:
SQLException
-
setCharacterStream
public Writer setCharacterStream(long pos) throws SQLException
- Specified by:
setCharacterStream
in interfaceClob
- Throws:
SQLException
-
free
public void free() throws SQLException
Free the Blob object and releases the resources that it holds. The object is invalid once the free method is called.- Specified by:
free
in interfaceClob
- Throws:
SQLException
- if an error occurs
-
getCharacterStream
public Reader getCharacterStream(long pos, long length) throws SQLException
Returns a Reader object that contains a partial Clob value, starting with the character specified by pos, which is length characters in length.- Specified by:
getCharacterStream
in interfaceClob
- Parameters:
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 retrieved- Throws:
SQLException
-
getSubString
public String getSubString(long pos, int length) throws SQLException
- Specified by:
getSubString
in interfaceClob
- Throws:
SQLException
-
setString
public int setString(long pos, String str) throws SQLException
- Specified by:
setString
in interfaceClob
- Throws:
SQLException
-
setString
public int setString(long pos, String str, int offset, int len) throws SQLException
- Specified by:
setString
in interfaceClob
- Throws:
SQLException
-
position
public long position(String searchstr, long start) throws SQLException
- Specified by:
position
in interfaceClob
- Throws:
SQLException
-
position
public long position(Clob searchstr, long start) throws SQLException
- Specified by:
position
in interfaceClob
- Throws:
SQLException
-
-