Note
In the case that the data is large, it is represented as a stream. This stream can be returned to the user in the getAsciiStream() method. This means that we have limited control over the state of the stream, since the user can read bytes from it at any time. Thus all methods here reset the stream to the beginning before doing any work.
Caveat
The methods may not behave correctly if a user sets up multiple threads and sucks data from the stream (returned from getAsciiStream()) at the same time as calling the Clob methods.
Supports
| Modifier and Type | Field and Description |
|---|---|
| private InternalClob | clob
The underlying Clob object, which may change depending on what the user does with the Clob. |
| private boolean | isValid
Tells whether the Clob has been freed or not. |
| private int |
| Access | Constructor and Description |
|---|---|
| pack-priv | EmbedClob(EmbedConnection
The Connection object associated with this EmbedClob object. con)Creates an empty Clob object. |
| protected | EmbedClob(EmbedConnection
associated connection for the Clob con, StringDataValue string data value descriptor providing the Clob source dvd)Creates a Clob on top of a data value descriptor. |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public void | free()
Implements java. Frees the |
| public InputStream | Returns: An Ascii stream containing theCLOB data. Valid
values in the stream are 0 - 255.Implements java. Gets the |
| public Reader | Returns: A character stream containing theCLOB data.Implements java. Gets the |
| public Reader | Returns: Reader through which the partial Clob
value can be read.the offset to the first character of the partial value to
be retrieved. The first character in the Clob is at position 1. pos, long the length in characters of the partial value to be
retrieved. length)Implements java. Returns a |
| pack-priv InternalClob | Returns: The current internal Clob representation.Returns the current internal Clob representation. |
| public int | Returns: locator value for this Clob.Implements org. Returns LOB locator key. |
| public String | Returns: AString that is the specified substring in the
CLOB value designated by this Clob objectthe first character of the substring to be extracted.
The first character is at position 1. pos, int the number of consecutive characters to be copied length)Implements java. Returns a copy of the specified substring in the |
| public long | Returns: The length of theCLOB in number of characters.Implements java. Returns the number of characters in the |
| private void | |
| private void | makeWritableClobClone(long
number of characters to be cloned (should be smaller
than clob length) len)Makes a writable clone of the current Clob. |
| public long | Returns: The position at which the substring appears,-1 if
it does not appear in the CLOB value. The first position
is 1.the substring for which to search searchStr, long the position at which to begin searching; the first position
is start)1Implements java. Determines the character position at which the specified substring
|
| public long | Returns: the position at which theClob object appears,
else -1; the first position is 1the searchClob, long Clob object for which to searchthe position at which to begin searching; the first
position is 1 start)Implements java. Determines the character position at which the specified
|
| public OutputStream | Returns: the stream to which ASCII encoded characters can be writtenthe position at which to start writing to this Clob object pos)Implements java. JDBC 3.0 Retrieves a stream to be used to write Ascii characters to the CLOB value that this Clob object represents, starting at position pos. |
| public Writer | Returns: the stream to which Unicode encoded characters can be writtenthe position at which to start writing to this Clob object pos)Implements java. JDBC 3.0 Retrieves a stream to be used to write a stream of characters to the CLOB value that this Clob object represents, starting at position pos. |
| public int | Returns: the number of characters writtenthe position at which to start writing to the CLOB value that
this Clob object represents pos, String the string to be written to the str)CLOB
value that this Clob designatesImplements java. JDBC 3.0 Writes the given Java String to the CLOB value that this Clob object designates at the position pos. |
| public int | Returns: the number of characters writtenthe position at which to start writing to this Clob object pos, String the string to be written to the CLOB value that this Clob
designates str, int the offset into str to start reading the characters to be
written offset, int the number of characters to be written len)Implements java. JDBC 3.0 Writes len characters of str, starting at character offset, to the CLOB value that this Clob represents. |
| public void | truncate(long
the length, in characters, to which the CLOB value should be
truncated, 0 is accepted len)Implements java. JDBC 3.0 Truncates the CLOB value that this Clob designates to have a length of len characters |
| clob | back to summary |
|---|---|
| private InternalClob clob The underlying Clob object, which may change depending on what the user does with the Clob. | |
| isValid | back to summary |
|---|---|
| private boolean isValid Tells whether the Clob has been freed or not. | |
| locator | back to summary |
|---|---|
| private int locator | |
| EmbedClob | back to summary |
|---|---|
| pack-priv EmbedClob(EmbedConnection con) throws SQLException Creates an empty Clob object.
| |
| EmbedClob | back to summary |
|---|---|
| protected EmbedClob(EmbedConnection con, StringDataValue dvd) throws StandardException, SQLException Creates a Clob on top of a data value descriptor.
This constructor should only be called by
| |
| checkValidity | back to summary |
|---|---|
| private void checkValidity() throws SQLException | |
| free | back to summary |
|---|---|
| public void free() throws SQLException Implements java. Frees the
The object is invalid once the
| |
| getAsciiStream | back to summary |
|---|---|
| public InputStream getAsciiStream() throws SQLException Implements java. Gets the
| |
| getCharacterStream | back to summary |
|---|---|
| public Reader getCharacterStream() throws SQLException Implements java. Gets the
| |
| getCharacterStream | back to summary |
|---|---|
| public Reader getCharacterStream(long pos, long length) throws SQLException Implements java. Returns a
| |
| getInternalClob | back to summary |
|---|---|
| pack-priv InternalClob getInternalClob() Returns the current internal Clob representation. Care should be taken, as the representation can change when the user performs operations on the Clob. An example is if the Clob content is served from a store stream and the user updates the content. The internal representation will then be changed to a temporary Clob copy that allows updates.
| |
| getLocator | back to summary |
|---|---|
| public int getLocator() Implements org. Doc from org. Returns LOB locator key.
The key can be used with
| |
| getSubString | back to summary |
|---|---|
| public String getSubString(long pos, int length) throws SQLException Implements java. Returns a copy of the specified substring in the
The substring begins at position If a larger length is requested than there are characters available, characters from the start position to the end of the CLOB are returned. Note If the starting position is the length of the CLOB plus 1, zero characters are returned regardless of the length requested.
| |
| length | back to summary |
|---|---|
| public long length() throws SQLException Implements java. Returns the number of characters in the
| |
| makeWritableClobClone | back to summary |
|---|---|
| private void makeWritableClobClone() throws IOException, SQLException Makes a writable clone of the current Clob.
This is called when we have a
| |
| makeWritableClobClone | back to summary |
|---|---|
| private void makeWritableClobClone(long len) throws IOException, SQLException Makes a writable clone of the current Clob.
This is called when we have a
| |
| position | back to summary |
|---|---|
| public long position(String searchStr, long start) throws SQLException Implements java. Determines the character position at which the specified substring
The search begins at position
If the
If the
The position where the stream has a char equal to the first char of
| |
| position | back to summary |
|---|---|
| public long position(Clob searchClob, long start) throws SQLException Implements java. Determines the character position at which the specified
| |
| setAsciiStream | back to summary |
|---|---|
| public OutputStream setAsciiStream(long pos) throws SQLException Implements java. JDBC 3.0 Retrieves a stream to be used to write Ascii characters to the CLOB value that this Clob object represents, starting at position pos.
| |
| setCharacterStream | back to summary |
|---|---|
| public Writer setCharacterStream(long pos) throws SQLException Implements java. JDBC 3.0 Retrieves a stream to be used to write a stream of characters to the CLOB value that this Clob object represents, starting at position pos.
| |
| setString | back to summary |
|---|---|
| public int setString(long pos, String str) throws SQLException Implements java. JDBC 3.0 Writes the given Java String to the CLOB value that this Clob object designates at the position pos.
| |
| setString | back to summary |
|---|---|
| public int setString(long pos, String str, int offset, int len) throws SQLException Implements java. JDBC 3.0 Writes len characters of str, starting at character offset, to the CLOB value that this Clob represents.
| |
| truncate | back to summary |
|---|---|
| public void truncate(long len) throws SQLException Implements java. JDBC 3.0 Truncates the CLOB value that this Clob designates to have a length of len characters
| |