Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.client.am
Class Clob  view Clob download Clob.java

java.lang.Object
  extended byorg.apache.derby.client.am.Lob
      extended byorg.apache.derby.client.am.Clob
All Implemented Interfaces:
java.sql.Clob, UnitOfWorkListener

public class Clob
extends Lob
implements java.sql.Clob


Field Summary
protected  java.io.InputStream asciiStream_
           
protected  java.io.Reader characterStream_
           
protected  java.lang.String encoding_
           
private  PreparedStatement internalLengthStmt_
           
protected  long lengthInBytes_
           
protected  java.lang.String string_
           
protected  java.io.InputStream unicodeStream_
           
protected  byte[] utf8String_
           
 
Fields inherited from class org.apache.derby.client.am.Lob
agent_, ASCII_STREAM, BINARY_STREAM, BINARY_STRING, CHARACTER_STREAM, dataType_, lengthObtained_, sqlLength_, STRING, UNICODE_STREAM
 
Constructor Summary
private Clob(Agent agent)
           
  Clob(Agent agent, byte[] unconvertedBytes, java.lang.String charsetName, int dataOffset)
           
  Clob(Agent agent, java.io.InputStream inputStream, java.lang.String encoding, int length)
           
  Clob(Agent agent, java.io.Reader reader, int length)
           
  Clob(Agent agent, java.lang.String string)
           
 
Method Summary
 void convertFromAsciiToCharacterStream()
           
protected  Clob createClobWrapper(java.sql.Clob clob)
           
protected  void finalize()
          Called on an object by the Virtual Machine at most once, at some point after the Object is determined unreachable but before it is destroyed.
 java.io.InputStream getAsciiStream()
          This method returns a byte stream that reads the contents of this Clob as a series of ASCII bytes.
private  java.io.InputStream getAsciiStreamX()
           
 long getByteLength()
           
 java.io.Reader getCharacterStream()
          This method returns a character stream that reads the contents of this Clob.
private  java.io.Reader getCharacterStreamX()
           
 java.lang.String getString()
           
 java.lang.String getSubString(long pos, int length)
          This method returns the specified portion of this Clob as a String.
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()
          This method returns the number of characters in this Clob.
 long position(java.sql.Clob searchstr, long start)
          This method returns the index into this Clob of the first occurrence of the specified character pattern (supplied by the caller as a Clob).
 long position(java.lang.String searchstr, long start)
          This method returns the index into this Clob of the first occurrence of the specified character pattern (supplied by the caller as a String).
private  long positionX(java.sql.Clob searchstr, long start)
           
private  long positionX(java.lang.String searchstr, long start)
           
 java.io.OutputStream setAsciiStream(long pos)
          Returns an ASCII text stream that writes into this Clob, starting at the specified index.
 java.io.Writer setCharacterStream(long pos)
          Returns a character stream that writes into this Clob, starting at the specified index.
 int setString(long pos, java.lang.String str)
          Writes the specified string into this Clob, starting at the specified index.
 int setString(long pos, java.lang.String str, int offset, int len)
          Writes the specified portion of a string into this Clob, starting at the specified index.
 int setStringX(long pos, java.lang.String str, int offset, int len)
           
 void truncate(long len)
          Truncates this Clob to be at most the specified number of characters long.
 
Methods inherited from class org.apache.derby.client.am.Lob
checkForClosedConnection, completeLocalCommit, completeLocalCommit, completeLocalRollback, completeLocalRollback, getAgent, listenToUnitOfWork, sqlLength
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

string_

protected java.lang.String string_

asciiStream_

protected java.io.InputStream asciiStream_

unicodeStream_

protected java.io.InputStream unicodeStream_

characterStream_

protected java.io.Reader characterStream_

utf8String_

protected byte[] utf8String_

lengthInBytes_

protected long lengthInBytes_

internalLengthStmt_

private PreparedStatement internalLengthStmt_

encoding_

protected java.lang.String encoding_
Constructor Detail

Clob

public Clob(Agent agent,
            java.lang.String string)

Clob

public Clob(Agent agent,
            byte[] unconvertedBytes,
            java.lang.String charsetName,
            int dataOffset)
     throws SqlException

Clob

public Clob(Agent agent,
            java.io.InputStream inputStream,
            java.lang.String encoding,
            int length)
     throws SqlException

Clob

public Clob(Agent agent,
            java.io.Reader reader,
            int length)

Clob

private Clob(Agent agent)
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Description copied from class: java.lang.Object
Called on an object by the Virtual Machine at most once, at some point after the Object is determined unreachable but before it is destroyed. You would think that this means it eventually is called on every Object, but this is not necessarily the case. If execution terminates abnormally, garbage collection does not always happen. Thus you cannot rely on this method to always work. For finer control over garbage collection, use references from the java.lang.ref package.

Virtual Machines are free to not call this method if they can determine that it does nothing important; for example, if your class extends Object and overrides finalize to do simply super.finalize().

finalize() will be called by a java.lang.Thread that has no locks on any Objects, and may be called concurrently. There are no guarantees on the order in which multiple objects are finalized. This means that finalize() is usually unsuited for performing actions that must be thread-safe, and that your implementation must be use defensive programming if it is to always work.

If an Exception is thrown from finalize() during garbage collection, it will be patently ignored and the Object will still be destroyed.

It is allowed, although not typical, for user code to call finalize() directly. User invocation does not affect whether automatic invocation will occur. It is also permitted, although not recommended, for a finalize() method to "revive" an object by making it reachable from normal code again.

Unlike constructors, finalize() does not get called for an object's superclass unless the implementation specifically calls super.finalize().

The default implementation does nothing.

Overrides:
finalize in class Lob

length

public long length()
            throws SqlException
Description copied from interface: java.sql.Clob
This method returns the number of characters in this Clob.

Specified by:
length in interface java.sql.Clob

getSubString

public java.lang.String getSubString(long pos,
                                     int length)
                              throws SqlException
Description copied from interface: java.sql.Clob
This method returns the specified portion of this Clob as a String.

Specified by:
getSubString in interface java.sql.Clob

getSubStringX

private java.lang.String getSubStringX(long pos,
                                       int length)
                                throws SqlException

getCharacterStream

public java.io.Reader getCharacterStream()
                                  throws SqlException
Description copied from interface: java.sql.Clob
This method returns a character stream that reads the contents of this Clob.

Specified by:
getCharacterStream in interface java.sql.Clob

getCharacterStreamX

private java.io.Reader getCharacterStreamX()
                                    throws SqlException

getAsciiStream

public java.io.InputStream getAsciiStream()
                                   throws SqlException
Description copied from interface: java.sql.Clob
This method returns a byte stream that reads the contents of this Clob as a series of ASCII bytes.

Specified by:
getAsciiStream in interface java.sql.Clob

getAsciiStreamX

private java.io.InputStream getAsciiStreamX()
                                     throws SqlException

position

public long position(java.lang.String searchstr,
                     long start)
              throws SqlException
Description copied from interface: java.sql.Clob
This method returns the index into this Clob of the first occurrence of the specified character pattern (supplied by the caller as a String). The search begins at the specified index.

Specified by:
position in interface java.sql.Clob

positionX

private long positionX(java.lang.String searchstr,
                       long start)
                throws SqlException

position

public long position(java.sql.Clob searchstr,
                     long start)
              throws SqlException
Description copied from interface: java.sql.Clob
This method returns the index into this Clob of the first occurrence of the specified character pattern (supplied by the caller as a Clob). The search begins at the specified index.

Specified by:
position in interface java.sql.Clob

positionX

private long positionX(java.sql.Clob searchstr,
                       long start)
                throws SqlException

setString

public int setString(long pos,
                     java.lang.String str)
              throws SqlException
Description copied from interface: java.sql.Clob
Writes the specified string into this Clob, starting at the specified index.

Specified by:
setString in interface java.sql.Clob

setString

public int setString(long pos,
                     java.lang.String str,
                     int offset,
                     int len)
              throws SqlException
Description copied from interface: java.sql.Clob
Writes the specified portion of a string into this Clob, starting at the specified index.

Specified by:
setString in interface java.sql.Clob

setStringX

public int setStringX(long pos,
                      java.lang.String str,
                      int offset,
                      int len)
               throws SqlException

setAsciiStream

public java.io.OutputStream setAsciiStream(long pos)
                                    throws SqlException
Description copied from interface: java.sql.Clob
Returns an ASCII text stream that writes into this Clob, starting at the specified index.

Specified by:
setAsciiStream in interface java.sql.Clob

setCharacterStream

public java.io.Writer setCharacterStream(long pos)
                                  throws SqlException
Description copied from interface: java.sql.Clob
Returns a character stream that writes into this Clob, starting at the specified index.

Specified by:
setCharacterStream in interface java.sql.Clob

truncate

public void truncate(long len)
              throws SqlException
Description copied from interface: java.sql.Clob
Truncates this Clob to be at most the specified number of characters long.

Specified by:
truncate in interface java.sql.Clob

isString

public boolean isString()

isAsciiStream

public boolean isAsciiStream()

isCharacterStream

public boolean isCharacterStream()

isUnicodeStream

public boolean isUnicodeStream()

getUnicodeStream

public java.io.InputStream getUnicodeStream()

getString

public java.lang.String getString()

getUtf8String

public byte[] getUtf8String()

getUTF8Length

public int getUTF8Length()
                  throws SqlException

createClobWrapper

protected Clob createClobWrapper(java.sql.Clob clob)
                          throws SqlException

convertFromAsciiToCharacterStream

public void convertFromAsciiToCharacterStream()
                                       throws SqlException

getByteLength

public long getByteLength()
                   throws SqlException