java.sql.Clob
, UnitOfWorkListener
public class ClientClob extends Lob implements java.sql.Clob
java.sql.Clob
interface.Modifier and Type | Field | Description |
---|---|---|
private java.io.InputStream |
asciiStream_ |
|
private java.io.Reader |
characterStream_ |
|
protected java.lang.String |
string_ |
|
private java.io.InputStream |
unicodeStream_ |
|
private byte[] |
utf8String_ |
agent_, ASCII_STREAM, BINARY_STREAM, BINARY_STRING, CHARACTER_STREAM, dataType_, INVALID_LOCATOR, isValid_, LOCATOR, locator_, STRING, UNICODE_STREAM
Modifier | Constructor | Description |
---|---|---|
private |
ClientClob(Agent agent,
boolean willBeLayerBStreamed) |
|
|
ClientClob(Agent agent,
byte[] unconvertedBytes,
java.nio.charset.Charset charset,
int dataOffset) |
|
|
ClientClob(Agent agent,
int locator) |
Create a
ClientClob object for a Clob value stored
on the server and indentified by locator . |
(package private) |
ClientClob(Agent agent,
java.io.InputStream inputStream,
java.nio.charset.Charset encoding) |
Create a
ClientClob of unknown length with the specified
encoding. |
|
ClientClob(Agent agent,
java.io.InputStream inputStream,
java.nio.charset.Charset encoding,
int length) |
|
(package private) |
ClientClob(Agent agent,
java.io.Reader reader) |
Create a
ClientClob of unknown length. |
(package private) |
ClientClob(Agent agent,
java.io.Reader reader,
int length) |
|
|
ClientClob(Agent agent,
java.lang.String string) |
Modifier and Type | Method | Description |
---|---|---|
void |
free() |
This method frees the
Clob object and releases the resources the resources
that it holds. |
java.io.InputStream |
getAsciiStream() |
|
(package private) java.io.InputStream |
getAsciiStreamX() |
|
java.io.Reader |
getCharacterStream() |
|
java.io.Reader |
getCharacterStream(long pos,
long length) |
Returns a
Reader object that contains a partial
Clob value, starting with the character specified by pos,
which is length characters in length. |
(package private) java.io.Reader |
getCharacterStreamX() |
|
(package private) long |
getLocatorLength() |
Get the length in bytes of the
Clob value represented by
this locator based Clob object. |
java.lang.String |
getString() |
|
java.lang.String |
getSubString(long pos,
int length) |
Returns a copy of the specified substring
in the
CLOB value
designated by this ClientClob object. |
private java.lang.String |
getSubStringX(long pos,
int length) |
|
java.io.InputStream |
getUnicodeStream() |
|
int |
getUTF8Length() |
|
byte[] |
getUtf8String() |
|
boolean |
isAsciiStream() |
|
boolean |
isCharacterStream() |
|
boolean |
isString() |
|
boolean |
isUnicodeStream() |
|
long |
length() |
|
protected void |
materializeStream() |
Materialize the stream used for input to the database.
|
long |
position(java.lang.String searchstr,
long start) |
|
long |
position(java.sql.Clob searchstr,
long start) |
|
private long |
positionX(java.lang.String searchstr,
long start) |
|
private long |
positionX(java.sql.Clob searchstr,
long start) |
|
(package private) void |
reInitForNonLocator(java.lang.String newString) |
Reinitialize the value of this CLOB.
|
java.io.OutputStream |
setAsciiStream(long pos) |
|
java.io.Writer |
setCharacterStream(long pos) |
|
int |
setString(long pos,
java.lang.String str) |
|
int |
setString(long pos,
java.lang.String str,
int offset,
int len) |
|
(package private) int |
setStringX(long pos,
java.lang.String str,
int offset,
int len) |
|
void |
truncate(long len) |
checkForClosedConnection, checkForLocatorValidity, checkPosAndLength, checkValidity, completeLocalCommit, completeLocalRollback, getAgent, getLocator, getUpdateCount, incrementUpdateCount, isLayerBStreamingPossible, isLocator, listenToUnitOfWork, materializeStream, setSqlLength, sqlLength, willBeLayerBStreamed
protected java.lang.String string_
private java.io.InputStream asciiStream_
private java.io.InputStream unicodeStream_
private java.io.Reader characterStream_
private byte[] utf8String_
public ClientClob(Agent agent, java.lang.String string)
public ClientClob(Agent agent, byte[] unconvertedBytes, java.nio.charset.Charset charset, int dataOffset) throws SqlException
SqlException
public ClientClob(Agent agent, java.io.InputStream inputStream, java.nio.charset.Charset encoding, int length)
ClientClob(Agent agent, java.io.InputStream inputStream, java.nio.charset.Charset encoding) throws SqlException
ClientClob
of unknown length with the specified
encoding.
This constructor was added to support the JDBC 4 length less overloads.
Note that a ClientClob
created with this constructor is
made for input to the database only. Do not pass it out to the user!agent
- inputStream
- the data to insertencoding
- encoding to use for characters. Only "ISO-8859-1" is
allowed.SqlException
ClientClob(Agent agent, java.io.Reader reader, int length)
public ClientClob(Agent agent, int locator)
ClientClob
object for a Clob value stored
on the server and indentified by locator
.agent
- context for this Clob
object (incl. connection).locator
- reference id to Clob
value on server.ClientClob(Agent agent, java.io.Reader reader)
ClientClob
of unknown length.
This constructor was added to support the JDBC 4 length less overloads.
Note that a ClientClob
created with this constructor is
made for input to the database only. Do not pass it out to the user!agent
- reader
- the data to insertprivate ClientClob(Agent agent, boolean willBeLayerBStreamed)
public long length() throws java.sql.SQLException
public java.lang.String getSubString(long pos, int length) throws java.sql.SQLException
CLOB
value
designated by this ClientClob
object.
The substring begins at position
pos
and has up to length
consecutive
characters. The starting position must be between 1 and the length
of the CLOB plus 1. This allows for zero-length CLOB values, from
which only zero-length substrings can be returned.
If a larger length is requested than there are characters available,
characters to the end of the CLOB are returned.getSubString
in interface java.sql.Clob
pos
- the first character of the substring to be extracted.
The first character is at position 1.length
- the number of consecutive characters to be copiedString
that is the specified substring in the
CLOB
value designated by this ClientClob
objectjava.sql.SQLException
- if there is an error accessing the
CLOB
NOTE: If the starting position is the length of the CLOB plus 1,
zero characters are returned regardless of the length requested.private java.lang.String getSubStringX(long pos, int length) throws SqlException
SqlException
public java.io.Reader getCharacterStream() throws java.sql.SQLException
getCharacterStream
in interface java.sql.Clob
java.sql.SQLException
java.io.Reader getCharacterStreamX() throws SqlException
SqlException
public java.io.InputStream getAsciiStream() throws java.sql.SQLException
getAsciiStream
in interface java.sql.Clob
java.sql.SQLException
java.io.InputStream getAsciiStreamX() throws SqlException
SqlException
public long position(java.lang.String searchstr, long start) throws java.sql.SQLException
position
in interface java.sql.Clob
java.sql.SQLException
private long positionX(java.lang.String searchstr, long start) throws SqlException
SqlException
public long position(java.sql.Clob searchstr, long start) throws java.sql.SQLException
position
in interface java.sql.Clob
java.sql.SQLException
private long positionX(java.sql.Clob searchstr, long start) throws SqlException
SqlException
public int setString(long pos, java.lang.String str) throws java.sql.SQLException
setString
in interface java.sql.Clob
java.sql.SQLException
public int setString(long pos, java.lang.String str, int offset, int len) throws java.sql.SQLException
setString
in interface java.sql.Clob
java.sql.SQLException
int setStringX(long pos, java.lang.String str, int offset, int len) throws SqlException
SqlException
public java.io.OutputStream setAsciiStream(long pos) throws java.sql.SQLException
setAsciiStream
in interface java.sql.Clob
java.sql.SQLException
public java.io.Writer setCharacterStream(long pos) throws java.sql.SQLException
setCharacterStream
in interface java.sql.Clob
java.sql.SQLException
public void truncate(long len) throws java.sql.SQLException
truncate
in interface java.sql.Clob
java.sql.SQLException
public void free() throws java.sql.SQLException
Clob
object and releases the resources the resources
that it holds. The object is invalid once the free
method
is called. If free
is called multiple times, the
subsequent calls to free
are treated as a no-op.free
in interface java.sql.Clob
java.sql.SQLException
- if an error occurs releasing
the Clob's resourcespublic java.io.Reader getCharacterStream(long pos, long length) throws java.sql.SQLException
Reader
object that contains a partial
Clob
value, starting with the character specified by pos,
which is length characters in length.getCharacterStream
in interface java.sql.Clob
pos
- the offset to the first character of the partial value to
be retrieved. The first character in the Clob is at position 1.length
- the length in characters of the partial value to be
retrieved.Reader
through which the partial Clob
value can be read.java.sql.SQLException
- if pos is less than 1 or if pos is greater than the
number of
characters in the Clob
or if pos + length
is greater than
Clob.length() +1
public boolean isString()
public boolean isAsciiStream()
public boolean isCharacterStream()
public boolean isUnicodeStream()
public java.io.InputStream getUnicodeStream()
public java.lang.String getString()
public byte[] getUtf8String()
public int getUTF8Length()
void reInitForNonLocator(java.lang.String newString)
newString
- the new valueprotected void materializeStream() throws SqlException
materializeStream
in class Lob
SqlException
long getLocatorLength() throws SqlException
Clob
value represented by
this locator based Clob
object.
A stored procedure call will be made to get it from the server.getLocatorLength
in class Lob
Clob
in bytesSqlException
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.