org.osesb.utilities.jdbc
Class ByteArrayClob

java.lang.Object
  extended by org.osesb.utilities.jdbc.ByteArrayClob
All Implemented Interfaces:
java.sql.Clob

public class ByteArrayClob
extends java.lang.Object
implements java.sql.Clob

Utility Implementation for dealing with java.sql.Clob objects. For example, use this class to insert a Clob column or with the ResultSet, updateClob() method.

This class is not compatible with Oracle. Use the getOracleClobImplementation() method in org.osesb.utilities.jdbc.JDBCUtilities.

See Also:
JDBCUtilitiesTest.testClob()

Field Summary
protected  java.lang.StringBuffer buff
          StringBuffer for Clob data.
protected  java.io.ByteArrayOutputStream clobStorage
          ByteArrayOutputStream for Clob data.
protected  java.lang.String thisClassName
          The full name of this class.
 
Constructor Summary
ByteArrayClob(byte[] clobData)
          Creates a new instance of ByteArrayClob.
ByteArrayClob(java.lang.String clobData)
          Creates a new instance of ByteArrayClob.
 
Method Summary
 java.io.InputStream getAsciiStream()
           
 java.io.Reader getCharacterStream()
           
 java.lang.String getSubString(long pos, int length)
           
 long length()
           
static void main(java.lang.String[] args)
           
 long position(java.sql.Clob searchstr, long start)
           
 long position(java.lang.String searchstr, long start)
           
 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)
           
 void truncate(long len)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clobStorage

protected java.io.ByteArrayOutputStream clobStorage
ByteArrayOutputStream for Clob data.


buff

protected java.lang.StringBuffer buff
StringBuffer for Clob data.


thisClassName

protected java.lang.String thisClassName
The full name of this class.

Constructor Detail

ByteArrayClob

public ByteArrayClob(java.lang.String clobData)
              throws java.lang.Exception
Creates a new instance of ByteArrayClob.

Parameters:
clobData - Clob data as a String.
Throws:
java.lang.Exception - if constructed with invalid parameters.

ByteArrayClob

public ByteArrayClob(byte[] clobData)
              throws java.lang.Exception
Creates a new instance of ByteArrayClob.

Parameters:
clobData - Clob data as a byte[].
Throws:
java.lang.Exception - if constructed with invalid parameters.
Method Detail

length

public long length()
Specified by:
length in interface java.sql.Clob

getSubString

public java.lang.String getSubString(long pos,
                                     int length)
Specified by:
getSubString in interface java.sql.Clob

getCharacterStream

public java.io.Reader getCharacterStream()
Specified by:
getCharacterStream in interface java.sql.Clob

getAsciiStream

public java.io.InputStream getAsciiStream()
Specified by:
getAsciiStream in interface java.sql.Clob

position

public long position(java.lang.String searchstr,
                     long start)
Specified by:
position in interface java.sql.Clob

position

public long position(java.sql.Clob searchstr,
                     long start)
Specified by:
position in interface java.sql.Clob

setString

public int setString(long pos,
                     java.lang.String str)
              throws java.sql.SQLException
Specified by:
setString in interface java.sql.Clob
Throws:
java.sql.SQLException

setString

public int setString(long pos,
                     java.lang.String str,
                     int offset,
                     int len)
              throws java.sql.SQLException
Specified by:
setString in interface java.sql.Clob
Throws:
java.sql.SQLException

setAsciiStream

public java.io.OutputStream setAsciiStream(long pos)
Specified by:
setAsciiStream in interface java.sql.Clob

setCharacterStream

public java.io.Writer setCharacterStream(long pos)
Specified by:
setCharacterStream in interface java.sql.Clob

truncate

public void truncate(long len)
              throws java.sql.SQLException
Specified by:
truncate in interface java.sql.Clob
Throws:
java.sql.SQLException

main

public static void main(java.lang.String[] args)