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 SQLCLOBtype. An SQLCLOBis 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 aClobobject using an SQLlocator(CLOB), which means that aClobobject contains a logical pointer to the SQLCLOBdata rather than the data itself. AClobobject is valid for the duration of the transaction in which it was created.The
Clobinterface provides methods for getting the length of an SQLCLOB(Character Large Object) value, for materializing aCLOBvalue on the client, and for searching for a substring orCLOBobject within aCLOBvalue. Methods in the interfacesResultSet,CallableStatement, andPreparedStatement, such asgetClobandsetCloballow a programmer to access an SQLCLOBvalue. In addition, this interface has methods for updating aCLOBvalue.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfree()Free the Blob object and releases the resources that it holds.InputStreamgetAsciiStream()ReadergetCharacterStream()ReadergetCharacterStream(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.StringgetSubString(long pos, int length)longlength()longposition(String searchstr, long start)longposition(Clob searchstr, long start)OutputStreamsetAsciiStream(long pos)WritersetCharacterStream(long pos)intsetString(long pos, String str)intsetString(long pos, String str, int offset, int len)voidtruncate(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:
lengthin interfaceClob- Throws:
SQLException
-
truncate
public void truncate(long len) throws SQLException- Specified by:
truncatein interfaceClob- Throws:
SQLException
-
getAsciiStream
public InputStream getAsciiStream() throws SQLException
- Specified by:
getAsciiStreamin interfaceClob- Throws:
SQLException
-
setAsciiStream
public OutputStream setAsciiStream(long pos) throws SQLException
- Specified by:
setAsciiStreamin interfaceClob- Throws:
SQLException
-
getCharacterStream
public Reader getCharacterStream() throws SQLException
- Specified by:
getCharacterStreamin interfaceClob- Throws:
SQLException
-
setCharacterStream
public Writer setCharacterStream(long pos) throws SQLException
- Specified by:
setCharacterStreamin interfaceClob- Throws:
SQLException
-
free
public void free() throws SQLExceptionFree the Blob object and releases the resources that it holds. The object is invalid once the free method is called.- Specified by:
freein 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:
getCharacterStreamin 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:
getSubStringin interfaceClob- Throws:
SQLException
-
setString
public int setString(long pos, String str) throws SQLException- Specified by:
setStringin interfaceClob- Throws:
SQLException
-
setString
public int setString(long pos, String str, int offset, int len) throws SQLException- Specified by:
setStringin interfaceClob- Throws:
SQLException
-
position
public long position(String searchstr, long start) throws SQLException
- Specified by:
positionin interfaceClob- Throws:
SQLException
-
position
public long position(Clob searchstr, long start) throws SQLException
- Specified by:
positionin interfaceClob- Throws:
SQLException
-
-