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 int
compareTo(BaseClobType o)
boolean
equals(Object obj)
void
free()
InputStream
getAsciiStream()
Reader
getCharacterStream()
Reader
getCharacterStream(long pos, long len)
CharSequence
getCharSequence()
static String
getString(Clob clob)
Utility method to convert to StringString
getSubString(long pos, int len)
int
hashCode()
long
position(String searchstr, long start)
long
position(Clob searchstr, long start)
protected void
readReference(ObjectInput in)
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)
protected void
writeReference(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:
getAsciiStream
in interfaceClob
- Throws:
SQLException
- See Also:
Clob.getAsciiStream()
-
getCharacterStream
public Reader getCharacterStream() throws SQLException
- Specified by:
getCharacterStream
in interfaceClob
- Throws:
SQLException
- See Also:
Clob.getCharacterStream()
-
getSubString
public String getSubString(long pos, int len) throws SQLException
- Specified by:
getSubString
in interfaceClob
- Throws:
SQLException
- See Also:
Clob.getSubString(long, int)
-
position
public long position(Clob searchstr, long start) throws SQLException
- Specified by:
position
in interfaceClob
- Throws:
SQLException
- See Also:
Clob.position(java.sql.Clob, long)
-
position
public long position(String searchstr, long start) throws SQLException
- Specified by:
position
in interfaceClob
- Throws:
SQLException
- See Also:
Clob.position(java.lang.String, long)
-
setAsciiStream
public OutputStream setAsciiStream(long pos) throws SQLException
- Specified by:
setAsciiStream
in interfaceClob
- Throws:
SQLException
- See Also:
Clob.setAsciiStream(long)
-
setCharacterStream
public Writer setCharacterStream(long pos) throws SQLException
- Specified by:
setCharacterStream
in interfaceClob
- Throws:
SQLException
- See Also:
Clob.setCharacterStream(long)
-
setString
public int setString(long pos, String str, int offset, int len) throws SQLException
- Specified by:
setString
in 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:
setString
in interfaceClob
- Throws:
SQLException
- See Also:
Clob.setString(long, java.lang.String)
-
truncate
public void truncate(long len) throws SQLException
- Specified by:
truncate
in 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:
SQLException
IOException
-
getCharSequence
public CharSequence getCharSequence()
- Specified by:
getCharSequence
in interfaceSequencable
-
free
public void free() throws SQLException
- Specified by:
free
in interfaceClob
- Throws:
SQLException
-
getCharacterStream
public Reader getCharacterStream(long pos, long len) throws SQLException
- Specified by:
getCharacterStream
in interfaceClob
- Throws:
SQLException
-
readReference
protected void readReference(ObjectInput in) throws IOException
- Specified by:
readReference
in 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:
writeReference
in classStreamable<Clob>
- Throws:
IOException
-
compareTo
public int compareTo(BaseClobType o)
- Specified by:
compareTo
in interfaceComparable<BaseClobType>
-
-