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
BlobBuffer
class. 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
,position
and theset
methods 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 BlobBuffer
The underlyingBlobBuffer
.private static final String
0 lengthString
as initial value for emptyClob
s. -
Constructor Summary
ConstructorsConstructorDescriptionClobImpl
(JtdsConnection connection) Constructs a new emptyClob
instance.ClobImpl
(JtdsConnection connection, String str) Constructs a new initializedClob
instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
free()
(package private) BlobBuffer
Obtain this object's backingBlobBuffer
object.getCharacterStream
(long pos, long length) getSubString
(long pos, int length) long
length()
long
long
setAsciiStream
(long pos) setCharacterStream
(long pos) int
int
void
truncate
(long len)
-
Field Details
-
EMPTY_CLOB
0 lengthString
as initial value for emptyClob
s.- See Also:
-
blobBuffer
The underlyingBlobBuffer
.
-
-
Constructor Details
-
ClobImpl
ClobImpl(JtdsConnection connection) Constructs a new emptyClob
instance.- Parameters:
connection
- a reference to the parent connection object
-
ClobImpl
ClobImpl(JtdsConnection connection, String str) Constructs a new initializedClob
instance.- Parameters:
connection
- a reference to the parent connection objectstr
- theString
object to encapsulate
-
-
Method Details
-
getBlobBuffer
BlobBuffer getBlobBuffer()Obtain this object's backingBlobBuffer
object.- Returns:
- the underlying
BlobBuffer
-
getAsciiStream
- Specified by:
getAsciiStream
in interfaceClob
- Throws:
SQLException
-
getCharacterStream
- Specified by:
getCharacterStream
in interfaceClob
- Throws:
SQLException
-
getSubString
- Specified by:
getSubString
in interfaceClob
- Throws:
SQLException
-
length
- Specified by:
length
in interfaceClob
- Throws:
SQLException
-
position
- Specified by:
position
in interfaceClob
- Throws:
SQLException
-
position
- Specified by:
position
in interfaceClob
- Throws:
SQLException
-
setAsciiStream
- Specified by:
setAsciiStream
in interfaceClob
- Throws:
SQLException
-
setCharacterStream
- Specified by:
setCharacterStream
in interfaceClob
- Throws:
SQLException
-
setString
- Specified by:
setString
in interfaceClob
- Throws:
SQLException
-
setString
- Specified by:
setString
in interfaceClob
- Throws:
SQLException
-
truncate
- Specified by:
truncate
in interfaceClob
- Throws:
SQLException
-
free
- Specified by:
free
in interfaceClob
- Throws:
SQLException
-
getCharacterStream
- Specified by:
getCharacterStream
in interfaceClob
- Throws:
SQLException
-