org.apache.derby.impl.jdbc
Class EmbedClob

java.lang.Object
  extended byorg.apache.derby.impl.jdbc.ConnectionChild
      extended byorg.apache.derby.impl.jdbc.EmbedClob
All Implemented Interfaces:
java.sql.Clob

final class EmbedClob
extends ConnectionChild
implements java.sql.Clob


Field Summary
private  boolean isString
           
private  java.io.InputStream myStream
           
private  java.lang.String myString
           
 
Fields inherited from class org.apache.derby.impl.jdbc.ConnectionChild
CLOSE, factory, localConn, NOCLOSE
 
Constructor Summary
protected EmbedClob(DataValueDescriptor dvd, EmbedConnection con)
           
 
Method Summary
protected  void finalize()
           
 java.io.InputStream getAsciiStream()
          Gets the CLOB value designated by this Clob object as a stream of Ascii bytes.
 java.io.Reader getCharacterStream()
          Gets the Clob contents as a Unicode stream.
private  UTF8Reader getCharacterStreamAtPos(long position, java.lang.Object synchronization)
           
 java.lang.String getSubString(long pos, int length)
          Returns a copy of the specified substring in the CLOB value designated by this Clob object.
 long length()
          Returns the number of characters in the CLOB value designated by this Clob object.
(package private) static java.sql.SQLException noStateChangeLOB(java.lang.Throwable t)
           
 long position(java.sql.Clob searchClob, long start)
          Determines the character position at which the specified Clob object searchstr appears in this Clob object.
 long position(java.lang.String searchStr, long start)
          Determines the character position at which the specified substring searchstr appears in the CLOB.
 java.io.OutputStream setAsciiStream(long pos)
          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.
 java.io.Writer setCharacterStream(long pos)
          JDBC 3.0 Retrieves a stream to be used to write a stream of Unicode characters to the CLOB value that this Clob object represents, starting at position pos.
 int setString(long pos, java.lang.String parameterName)
          JDBC 3.0 Writes the given Java String to the CLOB value that this Clob object designates at the position pos.
 int setString(long pos, java.lang.String str, int offset, int len)
          JDBC 3.0 Writes len characters of str, starting at character offset, to the CLOB value that this Clob represents.
 void truncate(long len)
          JDBC 3.0 Truncates the CLOB value that this Clob designates to have a length of len characters
 
Methods inherited from class org.apache.derby.impl.jdbc.ConnectionChild
commitIfAutoCommit, commitIfNeeded, getCal, getConnectionSynchronization, getContextManager, getDatabase, getEmbedConnection, handleException, handleException, needCommit, newSQLException, newSQLException, newSQLException, restoreContextStack, setupContextStack
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isString

private boolean isString

myStream

private java.io.InputStream myStream

myString

private java.lang.String myString
Constructor Detail

EmbedClob

protected EmbedClob(DataValueDescriptor dvd,
                    EmbedConnection con)
             throws StandardException
Method Detail

length

public long length()
            throws java.sql.SQLException
Returns the number of characters in the CLOB value designated by this Clob object.

Specified by:
length in interface java.sql.Clob
Returns:
length of the CLOB in characters
Throws:
java.sql.SQLException - if there is an error accessing the length of the CLOB

getSubString

public java.lang.String getSubString(long pos,
                                     int length)
                              throws java.sql.SQLException
Returns a copy of the specified substring in the CLOB value designated by this Clob object. The substring begins at position pos and has up to length consecutive characters.

Specified by:
getSubString in interface java.sql.Clob
Parameters:
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 copied
Returns:
a String that is the specified substring in the CLOB value designated by this Clob object
Throws:
java.sql.SQLException - if there is an error accessing the CLOB NOTE: return the empty string if pos is too large

getCharacterStream

public java.io.Reader getCharacterStream()
                                  throws java.sql.SQLException
Gets the Clob contents as a Unicode stream.

Specified by:
getCharacterStream in interface java.sql.Clob
Returns:
a Unicode stream containing the CLOB data
Throws:
java.sql.SQLException - if there is an error accessing the CLOB

getAsciiStream

public java.io.InputStream getAsciiStream()
                                   throws java.sql.SQLException
Gets the CLOB value designated by this Clob object as a stream of Ascii bytes.

Specified by:
getAsciiStream in interface java.sql.Clob
Returns:
an ascii stream containing the CLOB data
Throws:
java.sql.SQLException - if there is an error accessing the CLOB value

getCharacterStreamAtPos

private UTF8Reader getCharacterStreamAtPos(long position,
                                           java.lang.Object synchronization)
                                    throws java.io.IOException,
                                           StandardException
Throws:
java.io.IOException
StandardException

position

public long position(java.lang.String searchStr,
                     long start)
              throws java.sql.SQLException
Determines the character position at which the specified substring searchstr appears in the CLOB. The search begins at position start.

Specified by:
position in interface java.sql.Clob
Parameters:
start - the position at which to begin searching; the first position is 1
Returns:
the position at which the substring appears, else -1; the first position is 1
Throws:
java.sql.SQLException - if there is an error accessing the CLOB value

position

public long position(java.sql.Clob searchClob,
                     long start)
              throws java.sql.SQLException
Determines the character position at which the specified Clob object searchstr appears in this Clob object. The search begins at position start.

Specified by:
position in interface java.sql.Clob
Parameters:
start - the position at which to begin searching; the first position is 1
Returns:
the position at which the Clob object appears, else -1; the first position is 1
Throws:
java.sql.SQLException - if there is an error accessing the CLOB value

finalize

protected void finalize()

setString

public int setString(long pos,
                     java.lang.String parameterName)
              throws java.sql.SQLException
JDBC 3.0 Writes the given Java String to the CLOB value that this Clob object designates at the position pos.

Specified by:
setString in interface java.sql.Clob
Parameters:
pos - - the position at which to start writing to the CLOB value that this Clob object represents
Returns:
the number of characters written
Throws:
java.sql.SQLException - Feature not implemented for now.

setString

public int setString(long pos,
                     java.lang.String str,
                     int offset,
                     int len)
              throws java.sql.SQLException
JDBC 3.0 Writes len characters of str, starting at character offset, to the CLOB value that this Clob represents.

Specified by:
setString in interface java.sql.Clob
Parameters:
pos - - the position at which to start writing to this Clob object
str - - the string to be written to the CLOB value that this Clob designates
offset - - the offset into str to start reading the characters to be written
len - - the number of characters to be written
Returns:
the number of characters written
Throws:
java.sql.SQLException - Feature not implemented for now.

setAsciiStream

public java.io.OutputStream setAsciiStream(long pos)
                                    throws java.sql.SQLException
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.

Specified by:
setAsciiStream in interface java.sql.Clob
Parameters:
pos - - the position at which to start writing to this Clob object
Returns:
the stream to which ASCII encoded characters can be written
Throws:
java.sql.SQLException - Feature not implemented for now.

setCharacterStream

public java.io.Writer setCharacterStream(long pos)
                                  throws java.sql.SQLException
JDBC 3.0 Retrieves a stream to be used to write a stream of Unicode characters to the CLOB value that this Clob object represents, starting at position pos.

Specified by:
setCharacterStream in interface java.sql.Clob
Parameters:
pos - - the position at which to start writing to this Clob object
Returns:
the stream to which Unicode encoded characters can be written
Throws:
java.sql.SQLException - Feature not implemented for now.

truncate

public void truncate(long len)
              throws java.sql.SQLException
JDBC 3.0 Truncates the CLOB value that this Clob designates to have a length of len characters

Specified by:
truncate in interface java.sql.Clob
Parameters:
len - - the length, in bytes, to which the CLOB value that this Blob value should be truncated
Throws:
java.sql.SQLException - Feature not implemented for now.

noStateChangeLOB

static java.sql.SQLException noStateChangeLOB(java.lang.Throwable t)


Apache Derby V10.0 Engine Documentation - Copyright © 1997,2004 The Apache Software Foundation or its licensors, as applicable.