Package org.teiid.core.types
Class ClobImpl
- java.lang.Object
-
- org.teiid.core.types.BaseLob
-
- org.teiid.core.types.ClobImpl
-
- All Implemented Interfaces:
Externalizable
,Serializable
,Clob
,InputStreamFactory.StreamFactoryReference
public class ClobImpl extends BaseLob implements Clob
This object holds a chunk of char data and implements the JDBC Clob interface. This object presents a streaming interface and provides a way to access partial of the Clob data. Connectors can use this object when dealing with large objects.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Clob
createClob(char[] chars)
InputStream
getAsciiStream()
Reader
getCharacterStream(long arg0, long arg1)
String
getSubString(long pos, int length)
long
length()
Returns the number of characters in theCLOB
value designated by thisClob
object.long
position(String searchstr, long start)
Determines the character position at which the specified substringsearchstr
appears in the SQLCLOB
value represented by thisClob
object.long
position(Clob searchstr, long start)
Determines the character position at which the specifiedClob
objectsearchstr
appears in thisClob
object.OutputStream
setAsciiStream(long arg0)
Writer
setCharacterStream(long arg0)
int
setString(long arg0, String arg1)
int
setString(long arg0, String arg1, int arg2, int arg3)
void
truncate(long arg0)
-
Methods inherited from class org.teiid.core.types.BaseLob
free, getBinaryStream, getCharacterStream, getCharset, getStreamFactory, readExternal, setCharset, setEncoding, setStreamFactory, writeExternal
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.sql.Clob
free, getCharacterStream
-
-
-
-
Constructor Detail
-
ClobImpl
public ClobImpl()
-
ClobImpl
public ClobImpl(InputStreamFactory streamFactory, long length)
Creates a new ClobImpl. Note that the length is not taken from theInputStreamFactory
since it refers to bytes and not chars.- Parameters:
streamFactory
-length
-
-
ClobImpl
public ClobImpl(char[] chars)
-
ClobImpl
public ClobImpl(String str)
-
-
Method Detail
-
getAsciiStream
public InputStream getAsciiStream() throws SQLException
- Specified by:
getAsciiStream
in interfaceClob
- Throws:
SQLException
-
getSubString
public String getSubString(long pos, int length) throws SQLException
- Specified by:
getSubString
in interfaceClob
- Throws:
SQLException
-
length
public long length() throws SQLException
Returns the number of characters in theCLOB
value designated by thisClob
object.- Specified by:
length
in interfaceClob
- Overrides:
length
in classBaseLob
- Returns:
- length of the
CLOB
in characters - Throws:
SQLException
-
position
public long position(Clob searchstr, long start) throws SQLException
Determines the character position at which the specifiedClob
objectsearchstr
appears in thisClob
object. The search begins at positionstart
.- Specified by:
position
in interfaceClob
- Parameters:
searchstr
- theClob
object for which to searchstart
- the position at which to begin searching; the first position is 1- Returns:
- the position at which the
Clob
object appears, else -1; the first position is 1 - Throws:
SQLException
-
position
public long position(String searchstr, long start) throws SQLException
Determines the character position at which the specified substringsearchstr
appears in the SQLCLOB
value represented by thisClob
object. The search begins at positionstart
.- Specified by:
position
in interfaceClob
- Parameters:
searchstr
- the substring for which to searchstart
- the position at which to begin searching; the first position is 1- Returns:
- the position at which the substring appears, else -1; the first position is 1
- Throws:
SQLException
- if there is an error accessing theCLOB
value
-
getCharacterStream
public Reader getCharacterStream(long arg0, long arg1) throws SQLException
- Specified by:
getCharacterStream
in interfaceClob
- Throws:
SQLException
-
setAsciiStream
public OutputStream setAsciiStream(long arg0) throws SQLException
- Specified by:
setAsciiStream
in interfaceClob
- Throws:
SQLException
-
setCharacterStream
public Writer setCharacterStream(long arg0) throws SQLException
- Specified by:
setCharacterStream
in interfaceClob
- Throws:
SQLException
-
setString
public int setString(long arg0, String arg1) throws SQLException
- Specified by:
setString
in interfaceClob
- Throws:
SQLException
-
setString
public int setString(long arg0, String arg1, int arg2, int arg3) throws SQLException
- Specified by:
setString
in interfaceClob
- Throws:
SQLException
-
truncate
public void truncate(long arg0) throws SQLException
- Specified by:
truncate
in interfaceClob
- Throws:
SQLException
-
createClob
public static Clob createClob(char[] chars)
-
-