Package net.sourceforge.jtds.jdbc
Class ClobImpl
java.lang.Object
net.sourceforge.jtds.jdbc.ClobImpl
- All Implemented Interfaces:
Clob
An in-memory or disk based representation of character data.
Implementation note:
- This implementation stores the CLOB data in a byte array managed by
the
BlobBufferclass. Each character is stored in 2 sequential bytes using UTF-16LE encoding. - As a consequence of using UTF-16LE, Unicode 3.1 supplementary
characters may require an additional 2 bytes of storage. This
implementation assumes that character position parameters supplied to
getSubstring,positionand thesetmethods refer to 16 bit characters only. The presence of supplementary characters will cause the wrong characters to be accessed. - For the same reasons although the position method will return the correct start position for any given pattern in the array, the returned value may be different to that expected if supplementary characters exist in the text preceding the pattern.
- Version:
- $Id: ClobImpl.java,v 1.36.2.3 2009-12-30 08:45:34 ickzon Exp $
- Author:
- Brian Heineman, Mike Hutchinson
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BlobBufferThe underlyingBlobBuffer.private static final String0 lengthStringas initial value for emptyClobs. -
Constructor Summary
ConstructorsConstructorDescriptionClobImpl(JtdsConnection connection) Constructs a new emptyClobinstance.ClobImpl(JtdsConnection connection, String str) Constructs a new initializedClobinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidfree()(package private) BlobBufferObtain this object's backingBlobBufferobject.getCharacterStream(long pos, long length) getSubString(long pos, int length) longlength()longlongsetAsciiStream(long pos) setCharacterStream(long pos) intintvoidtruncate(long len)
-
Field Details
-
EMPTY_CLOB
0 lengthStringas initial value for emptyClobs.- See Also:
-
blobBuffer
The underlyingBlobBuffer.
-
-
Constructor Details
-
ClobImpl
ClobImpl(JtdsConnection connection) Constructs a new emptyClobinstance.- Parameters:
connection- a reference to the parent connection object
-
ClobImpl
ClobImpl(JtdsConnection connection, String str) Constructs a new initializedClobinstance.- Parameters:
connection- a reference to the parent connection objectstr- theStringobject to encapsulate
-
-
Method Details
-
getBlobBuffer
BlobBuffer getBlobBuffer()Obtain this object's backingBlobBufferobject.- Returns:
- the underlying
BlobBuffer
-
getAsciiStream
- Specified by:
getAsciiStreamin interfaceClob- Throws:
SQLException
-
getCharacterStream
- Specified by:
getCharacterStreamin interfaceClob- Throws:
SQLException
-
getSubString
- Specified by:
getSubStringin interfaceClob- Throws:
SQLException
-
length
- Specified by:
lengthin interfaceClob- Throws:
SQLException
-
position
- Specified by:
positionin interfaceClob- Throws:
SQLException
-
position
- Specified by:
positionin interfaceClob- Throws:
SQLException
-
setAsciiStream
- Specified by:
setAsciiStreamin interfaceClob- Throws:
SQLException
-
setCharacterStream
- Specified by:
setCharacterStreamin interfaceClob- Throws:
SQLException
-
setString
- Specified by:
setStringin interfaceClob- Throws:
SQLException
-
setString
- Specified by:
setStringin interfaceClob- Throws:
SQLException
-
truncate
- Specified by:
truncatein interfaceClob- Throws:
SQLException
-
free
- Specified by:
freein interfaceClob- Throws:
SQLException
-
getCharacterStream
- Specified by:
getCharacterStreamin interfaceClob- Throws:
SQLException
-