Package org.teiid.core.types
Class BaseClobType
- java.lang.Object
-
- org.teiid.core.types.Streamable<Clob>
-
- org.teiid.core.types.BaseClobType
-
- All Implemented Interfaces:
Externalizable,Serializable,Comparable<BaseClobType>,Clob,NClob,Sequencable
public class BaseClobType extends Streamable<Clob> implements NClob, Sequencable, Comparable<BaseClobType>
This is wrapper on top of a "clob" object, which implements the "java.sql.Clob" interface. This class also implements the Streamable interface- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.teiid.core.types.Streamable
CHARSET, ENCODING, length, reference, STREAMING_BATCH_SIZE_IN_BYTES
-
-
Constructor Summary
Constructors Constructor Description BaseClobType()BaseClobType(Clob clob)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(BaseClobType o)booleanequals(Object obj)voidfree()InputStreamgetAsciiStream()ReadergetCharacterStream()ReadergetCharacterStream(long pos, long len)CharSequencegetCharSequence()static StringgetString(Clob clob)Utility method to convert to StringStringgetSubString(long pos, int len)inthashCode()longposition(String searchstr, long start)longposition(Clob searchstr, long start)protected voidreadReference(ObjectInput in)OutputStreamsetAsciiStream(long pos)WritersetCharacterStream(long pos)intsetString(long pos, String str)intsetString(long pos, String str, int offset, int len)voidtruncate(long len)protected voidwriteReference(DataOutput out)Since we have the length in chars we'll just write out in double byte format.-
Methods inherited from class org.teiid.core.types.Streamable
getLength, getReference, getReferenceStreamId, isBinary, length, readExternal, setReference, setReferenceStreamId, toString, writeExternal
-
-
-
-
Constructor Detail
-
BaseClobType
public BaseClobType()
-
BaseClobType
public BaseClobType(Clob clob)
-
-
Method Detail
-
getAsciiStream
public InputStream getAsciiStream() throws SQLException
- Specified by:
getAsciiStreamin interfaceClob- Throws:
SQLException- See Also:
Clob.getAsciiStream()
-
getCharacterStream
public Reader getCharacterStream() throws SQLException
- Specified by:
getCharacterStreamin interfaceClob- Throws:
SQLException- See Also:
Clob.getCharacterStream()
-
getSubString
public String getSubString(long pos, int len) throws SQLException
- Specified by:
getSubStringin interfaceClob- Throws:
SQLException- See Also:
Clob.getSubString(long, int)
-
position
public long position(Clob searchstr, long start) throws SQLException
- Specified by:
positionin interfaceClob- Throws:
SQLException- See Also:
Clob.position(java.sql.Clob, long)
-
position
public long position(String searchstr, long start) throws SQLException
- Specified by:
positionin interfaceClob- Throws:
SQLException- See Also:
Clob.position(java.lang.String, long)
-
setAsciiStream
public OutputStream setAsciiStream(long pos) throws SQLException
- Specified by:
setAsciiStreamin interfaceClob- Throws:
SQLException- See Also:
Clob.setAsciiStream(long)
-
setCharacterStream
public Writer setCharacterStream(long pos) throws SQLException
- Specified by:
setCharacterStreamin interfaceClob- Throws:
SQLException- See Also:
Clob.setCharacterStream(long)
-
setString
public int setString(long pos, String str, int offset, int len) throws SQLException- Specified by:
setStringin interfaceClob- Throws:
SQLException- See Also:
Clob.setString(long, java.lang.String, int, int)
-
setString
public int setString(long pos, String str) throws SQLException- Specified by:
setStringin interfaceClob- Throws:
SQLException- See Also:
Clob.setString(long, java.lang.String)
-
truncate
public void truncate(long len) throws SQLException- Specified by:
truncatein interfaceClob- Throws:
SQLException- See Also:
Clob.truncate(long)
-
getString
public static String getString(Clob clob) throws SQLException, IOException
Utility method to convert to String- Parameters:
clob-- Returns:
- string form of the clob passed.
- Throws:
SQLExceptionIOException
-
getCharSequence
public CharSequence getCharSequence()
- Specified by:
getCharSequencein interfaceSequencable
-
free
public void free() throws SQLException- Specified by:
freein interfaceClob- Throws:
SQLException
-
getCharacterStream
public Reader getCharacterStream(long pos, long len) throws SQLException
- Specified by:
getCharacterStreamin interfaceClob- Throws:
SQLException
-
readReference
protected void readReference(ObjectInput in) throws IOException
- Specified by:
readReferencein classStreamable<Clob>- Throws:
IOException
-
writeReference
protected void writeReference(DataOutput out) throws IOException
Since we have the length in chars we'll just write out in double byte format. These clobs should be small, so the wasted space should be minimal.- Specified by:
writeReferencein classStreamable<Clob>- Throws:
IOException
-
compareTo
public int compareTo(BaseClobType o)
- Specified by:
compareToin interfaceComparable<BaseClobType>
-
-