Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 2 (11.1.2.3.0)

E17483-04


oracle.jbo.domain.generic
Class GenericClob

java.lang.Object
  extended by oracle.jbo.domain.BaseLobDomain
      extended by oracle.jbo.domain.generic.GenericClob

All Implemented Interfaces:
java.io.Serializable, java.sql.Clob, BlobDomainInterface, DomainInterface, LobInterface, LobStreamInterface, MarshalledDomain, MutableDomainInterface, XMLDomainInterface, oracle.jdbc.internal.ObjectData, ORAData

public class GenericClob
extends BaseLobDomain
implements LobStreamInterface, java.io.Serializable, XMLDomainInterface, java.sql.Clob

This class provides a lightweight wrapper for oracle.sql.Clob, the Java representation of the Clob database type. This wrapper allows an instance of the oracle.sql.Clob to be used as a domain object.

Since:
JDeveloper 3.0
See Also:
Serialized Form

Nested Class Summary

 

Nested classes/interfaces inherited from class oracle.jbo.domain.BaseLobDomain
BaseLobDomain.BlobOutputStream

 

Field Summary

 

Fields inherited from class oracle.jbo.domain.BaseLobDomain
lob, mClient, mData, mDataModified, mIndexString, mNeedsServerSync, mOwner, relIdx, xAct

 

Constructor Summary
GenericClob()
          Constructor for this class.
GenericClob(char[] data)
          Constructs an instance of this class, given a char array.
GenericClob(java.sql.Clob clob)
          Constructs an instance of this class, given a Clob object.
GenericClob(java.sql.Clob clob, byte[] clobData)
          Deprecated. since 9.0.3.5. Use GenericClob(Clob clob, char[] clobData) Constructor instead.
GenericClob(java.sql.Clob clob, char[] clobData)
          Internal: Applications should not use this constructor.
GenericClob(GenericClob nclob, byte[] clobData)
          Deprecated. since 9.0.3.5. Use GenericClob(GenericClob clob, char[] clobData) Constructor instead.
GenericClob(GenericClob nclob, char[] clobData, java.sql.Connection conn)
          Creates an instance of this class with data as described in clobData and using the transaction context from clob to use the clob-locator in the database.
GenericClob(ResponseValues respVals)
           
GenericClob(java.lang.String str)
          Constructs an instance of this class, given a string.

 

Method Summary
 void closeCharacterOutputStream()
          Closes and cleansup internal reference to writer.
 void closeCharacterStream()
          Close the Clob contents as a Unicode reader.
 void closeOutputStream()
          Closes the OutputStream object.
static java.sql.Clob createEmptyCLOB(java.lang.Object context)
          Creates an empty Clob object.
 boolean equals(java.lang.Object obj)
          Converts all the data into a String and compares the two strings.
 void free()
           
 java.io.OutputStream getAsciiOutputStream()
          Deprecated. since 9.0.3.5. Use getCharacterOutputStream() instead.
 java.io.InputStream getAsciiStream()
          Deprecated. since 11.1.2.0.0. Use getCharacterStream() instead.
 int getBufferSize()
          Get ideal LOB db access buffer size.
 java.io.Writer getCharacterOutputStream()
          Returns a Writer for Unicode stream to the Clob that uses the default character encoding.
protected  java.io.Writer getCharacterOutputStream(long pos)
           
 java.io.Reader getCharacterStream()
          Gets the Clob contents as a Unicode reader.
 java.io.Reader getCharacterStream(long pos, long length)
           
 java.io.Reader getCharacterStream(java.lang.String enc)
          Deprecated. since 9.0.3.5. Use getCharacterStream() instead.
 java.lang.Object getData()
          Internal: Applications should not use this method.
 java.io.InputStream getInputStream()
          Deprecated. since 9.0.3.5. Use getCharacterStream() instead.
protected  java.io.InputStream getInternalDataStream()
           
protected  java.io.InputStream getInternalDataStream(long pos, long length)
           
protected  java.io.OutputStream getInternalOutputStream(long pos)
           
protected  java.io.InputStream getInternalStream()
           
protected  java.io.InputStream getInternalStream(long pos, long length)
           
 long getLength()
          Returns the number of characters in the Clob value designated by this Clob object.
 java.io.OutputStream getOutputStream()
          Deprecated. since 9.0.3.5. Use getCharacterOutputStream() instead.
 byte[] getStorageByteArray()
          Deprecated. since 9.0.3.5. Use getStorageCharArray() instead.
 byte[] getStorageByteArray(java.lang.String enc)
          Deprecated. since 9.0.3.5. Use getStorageCharArray() instead.
 char[] getStorageCharArray()
          Converts this Clob contents into a char array.
 java.lang.String getSubString(long offset, int length)
          Returns a copy of the specified substring in the Clob value designated by this Clob object.
 Node getXMLContentNode(Document xmlDoc)
          Creates the XML node in the given XML document for this domain's data.
static XMLDomainFactory getXMLDomainFactory(java.lang.Class attrClass)
          Internal: Applications should not use this method.
 long length()
           
 ResponseValues marshal()
          Internal: Applications should not use this method.
 long position(java.sql.Clob searchstr, long start)
           
 long position(java.lang.String searchstr, long start)
           
 void prepareForDML(java.lang.Object context)
          Internal: Applications should not use this method.
 java.lang.String printXMLDefinition(java.util.Hashtable allDefs, java.io.PrintWriter pw, boolean bContainees)
          Prints the DTD information for this domain in the given print writer.
protected  byte[] readBytesFromLob(long offset, int length)
           
protected  void resetCachedData()
           
 void saveToDatabase(Transaction xAct)
          Internal: Applications should not use this method.
 void saveToDatabase(Transaction xAct, java.lang.Object emptySQLObject)
          Internal: Applications should not use this method.
 java.io.OutputStream setAsciiStream(long pos)
           
 void setBytes(byte[] clobData)
          Deprecated. since 9.0.3.5. Use setChars(char[] clobData) instead.
 java.io.Writer setCharacterStream(long pos)
           
 void setChars(char[] clobData)
          Sets the Clob data for this object.
 void setIsBindVar(boolean isBindVar)
          Internal: Applications should not use this method.
 int setString(long pos, java.lang.String str)
           
 int setString(long pos, java.lang.String str, int offset, int length)
           
 void syncClientLob(LobInterface oldObj)
          Internal: Applications should not use this function.
protected  void syncLob(java.lang.Object otherLob)
           
 void syncServerLob(LobInterface oldObj)
          Internal: Applications should not use this function.
 char[] toCharArray()
          Converts this cLOB contents into a char array.
 java.lang.String toString()
          Converts this GenericClob object to a string.
 void truncate(long len)
           
 void useCLOB(java.sql.Clob newClob)
          Internal: Applications should not use this method.
protected  void writeBytesToLob()
           

 

Methods inherited from class oracle.jbo.domain.BaseLobDomain
closeInputStream, getInputStream, getInvokeDomainMethod, getOutputStream, getOwner, getOwnerAttributeIndex, getOwnerRow, getRemoteBufferSize, getRemoteIdString, getRemoteLength, getSize, isCacheDataModified, loadFromDatabase, setBytes, setContext, toByteArray, toDatum

 

Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Methods inherited from interface oracle.jbo.domain.LobStreamInterface
closeInputStream

 

Methods inherited from interface oracle.jbo.domain.LobInterface
getOwner, getOwnerAttributeIndex, getRemoteIdString, getSize

 

Methods inherited from interface oracle.jbo.domain.BlobDomainInterface
loadFromDatabase

 

Methods inherited from interface oracle.jbo.domain.DomainInterface
setContext

 

Constructor Detail

GenericClob

public GenericClob()
Constructor for this class.

GenericClob

public GenericClob(java.lang.String str)
Constructs an instance of this class, given a string.
Parameters:
str - a string to be used for a GenericClob.

GenericClob

public GenericClob(char[] data)
Constructs an instance of this class, given a char array.
Parameters:
data - a char array to be used for a GenericClob.

GenericClob

public GenericClob(java.sql.Clob clob)
Constructs an instance of this class, given a Clob object.
Parameters:
clob - a Clob to be used for a GenericClob.

GenericClob

public GenericClob(java.sql.Clob clob,
                   byte[] clobData)
Deprecated. since 9.0.3.5. Use GenericClob(Clob clob, char[] clobData) Constructor instead.
Internal: Applications should not use this constructor.

Creates an instance of this class with data as described in clobData and using the transaction context from clob to use the Clob locator in the database.

Parameters:
clob - name of the Clob to use as a GenericClob.
clobData - data to fill the Clob.

GenericClob

public GenericClob(java.sql.Clob clob,
                   char[] clobData)
Internal: Applications should not use this constructor.

Creates an instance of this class with char data as described in clobData and using the transaction context from clob to use the Clob locator in the database.

Parameters:
clob - name of the Clob to use as a GenericClob.
clobData - data to fill the Clob.

GenericClob

public GenericClob(GenericClob nclob,
                   byte[] clobData)
Deprecated. since 9.0.3.5. Use GenericClob(GenericClob clob, char[] clobData) Constructor instead.
Creates an instance of this class with data as described in clobData and using the transaction context from clob to use the clob-locator in the database.

This constructor should be used by applications using the framework to create GenericClob objects.

Parameters:
nclob - name of the Clob to use as a GenericClob.
clobData - data to fill the Clob.

GenericClob

public GenericClob(GenericClob nclob,
                   char[] clobData,
                   java.sql.Connection conn)
Creates an instance of this class with data as described in clobData and using the transaction context from clob to use the clob-locator in the database.

This constructor should be used by applications using the framework to create GenericClob objects.

Parameters:
nclob - name of the Clob to use as a GenericClob.
clobData - data to fill the Clob.

GenericClob

public GenericClob(ResponseValues respVals)

Method Detail

useCLOB

public void useCLOB(java.sql.Clob newClob)
Internal: Applications should not use this method.

If this object does not have a transaction context, shares the transaction and Clob locator from newClob.

Parameters:
newClob - name of the Clob with which this Clob will share its transaction and Clob locator information.

marshal

public ResponseValues marshal()
Internal: Applications should not use this method.
Specified by:
marshal in interface MarshalledDomain
Overrides:
marshal in class BaseLobDomain

prepareForDML

public void prepareForDML(java.lang.Object context)
Internal: Applications should not use this method.
Specified by:
prepareForDML in interface BlobDomainInterface
Specified by:
prepareForDML in class BaseLobDomain

setIsBindVar

public void setIsBindVar(boolean isBindVar)
Internal: Applications should not use this method.

saveToDatabase

public void saveToDatabase(Transaction xAct)
                    throws java.sql.SQLException
Internal: Applications should not use this method.

Uses the given transaction context to store data back into the database using the blob-locator which should be set before this method is invoked.

Specified by:
saveToDatabase in interface BlobDomainInterface
Overrides:
saveToDatabase in class BaseLobDomain
Parameters:
xAct - name of the transaction context.
Throws:
java.sql.SQLException

saveToDatabase

public void saveToDatabase(Transaction xAct,
                           java.lang.Object emptySQLObject)
                    throws java.sql.SQLException
Internal: Applications should not use this method.

Uses the given transaction context to store data back into the database using the blob-locator which should be set before this method is invoked.

Specified by:
saveToDatabase in interface BlobDomainInterface
Overrides:
saveToDatabase in class BaseLobDomain
Throws:
java.sql.SQLException

equals

public boolean equals(java.lang.Object obj)
Converts all the data into a String and compares the two strings. This is a default implementation of equals which could be overridden to perform more scalable application-specific comparision.
Overrides:
equals in class BaseLobDomain
Parameters:
obj - the object to compare to this GenericClob.

getXMLDomainFactory

public static XMLDomainFactory getXMLDomainFactory(java.lang.Class attrClass)
Internal: Applications should not use this method.

createEmptyCLOB

public static java.sql.Clob createEmptyCLOB(java.lang.Object context)
Creates an empty Clob object.
Parameters:
context - an internal framework context.

getSubString

public java.lang.String getSubString(long offset,
                                     int length)
Returns a copy of the specified substring in the Clob value designated by this Clob object. The substring begins at position offset and has up to length consecutive characters.
Specified by:
getSubString in interface java.sql.Clob
Parameters:
offset - 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

getAsciiOutputStream

public java.io.OutputStream getAsciiOutputStream()
Deprecated. since 9.0.3.5. Use getCharacterOutputStream() instead.
get ascii OutputStream of the Clob.
Returns:
a ascii output stream.

getInputStream

public java.io.InputStream getInputStream()
Deprecated. since 9.0.3.5. Use getCharacterStream() instead.
Gets the Clob value designated by this Clob object as a stream of Ascii bytes.
Specified by:
getInputStream in interface LobStreamInterface
Overrides:
getInputStream in class BaseLobDomain
Returns:
an InputStream containing the Clob data Clob value

getAsciiStream

public java.io.InputStream getAsciiStream()
Deprecated. since 11.1.2.0.0. Use getCharacterStream() instead.
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 Clob value

setAsciiStream

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

setCharacterStream

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

truncate

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

resetCachedData

protected void resetCachedData()
Overrides:
resetCachedData in class BaseLobDomain

getStorageCharArray

public char[] getStorageCharArray()
Converts this Clob contents into a char array.
Returns:
a Char array containing the contents of the Clob.

getStorageByteArray

public byte[] getStorageByteArray()
Deprecated. since 9.0.3.5. Use getStorageCharArray() instead.
Overrides:
getStorageByteArray in class BaseLobDomain

getStorageByteArray

public byte[] getStorageByteArray(java.lang.String enc)
Deprecated. since 9.0.3.5. Use getStorageCharArray() instead.

getOutputStream

public java.io.OutputStream getOutputStream()
Deprecated. since 9.0.3.5. Use getCharacterOutputStream() instead.
get OutputStream of the Domain.
Specified by:
getOutputStream in interface LobStreamInterface
Overrides:
getOutputStream in class BaseLobDomain
Returns:
an outputStream.

getCharacterOutputStream

public java.io.Writer getCharacterOutputStream()
Returns a Writer for Unicode stream to the Clob that uses the default character encoding.
Specified by:
getCharacterOutputStream in interface LobStreamInterface
Returns:
a Unicode character writer.

getCharacterOutputStream

protected java.io.Writer getCharacterOutputStream(long pos)

closeCharacterStream

public void closeCharacterStream()
Close the Clob contents as a Unicode reader. Clob
Specified by:
closeCharacterStream in interface LobStreamInterface
Overrides:
closeCharacterStream in class BaseLobDomain

getCharacterStream

public java.io.Reader getCharacterStream()
Gets the Clob contents as a Unicode reader.
Specified by:
getCharacterStream in interface java.sql.Clob
Specified by:
getCharacterStream in interface LobStreamInterface
Overrides:
getCharacterStream in class BaseLobDomain
Returns:
a Unicode reader containing the Clob data
Throws:
java.sql.SQLException - if there is an error accessing the Clob

getCharacterStream

public java.io.Reader getCharacterStream(java.lang.String enc)
Deprecated. since 9.0.3.5. Use getCharacterStream() instead.
Gets the Clob contents as a Unicode stream that uses the named character encoding.
Returns:
a Unicode stream containing the Clob data
Throws:
java.sql.SQLException - if there is an error accessing the Clob

getCharacterStream

public java.io.Reader getCharacterStream(long pos,
                                         long length)
                                  throws java.sql.SQLException
Specified by:
getCharacterStream in interface java.sql.Clob
Throws:
java.sql.SQLException

position

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

position

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

setString

public int setString(long pos,
                     java.lang.String str,
                     int offset,
                     int length)
              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)
              throws java.sql.SQLException
Specified by:
setString in interface java.sql.Clob
Throws:
java.sql.SQLException

setBytes

public void setBytes(byte[] clobData)
Deprecated. since 9.0.3.5. Use setChars(char[] clobData) instead.
Sets the Clob data for this object. On the client side, if there's a context available with this object, the bytes are streamed to the middle-tier object right-away. However if there's no context object, it's assumed that there will be a setAttribute call invoked on a containing row with this object as argument to stream the bytes via piggy-back.
Overrides:
setBytes in class BaseLobDomain
Parameters:
clobData - data to fill the Blob.

setChars

public void setChars(char[] clobData)
Sets the Clob data for this object. On the client side, if there's a context available with this object, the bytes are streamed to the middle-tier object right-away. However if there's no context object, it's assumed that there will be a setAttribute call invoked on a containing row with this object as argument to stream the bytes via piggy-back.
Parameters:
clobData - data to fill the Blob.

syncClientLob

public void syncClientLob(LobInterface oldObj)
Internal: Applications should not use this function.
Specified by:
syncClientLob in interface LobInterface
Overrides:
syncClientLob in class BaseLobDomain

syncServerLob

public void syncServerLob(LobInterface oldObj)
Internal: Applications should not use this function.
Specified by:
syncServerLob in interface LobInterface
Overrides:
syncServerLob in class BaseLobDomain

toString

public java.lang.String toString()
Converts this GenericClob object to a string.
Overrides:
toString in class BaseLobDomain
Returns:
this GenericClob as a string.

getData

public java.lang.Object getData()
Internal: Applications should not use this method.
Specified by:
getData in interface DomainInterface
Overrides:
getData in class BaseLobDomain
Returns:
a formatted value object.

toCharArray

public char[] toCharArray()
Converts this cLOB contents into a char array.
Returns:
a char array containing the contents of the BLOB.

readBytesFromLob

protected byte[] readBytesFromLob(long offset,
                                  int length)
Specified by:
readBytesFromLob in class BaseLobDomain

writeBytesToLob

protected void writeBytesToLob()
Specified by:
writeBytesToLob in class BaseLobDomain

getInternalOutputStream

protected java.io.OutputStream getInternalOutputStream(long pos)
Specified by:
getInternalOutputStream in class BaseLobDomain

getInternalStream

protected java.io.InputStream getInternalStream()
Specified by:
getInternalStream in class BaseLobDomain

getInternalStream

protected java.io.InputStream getInternalStream(long pos,
                                                long length)
Specified by:
getInternalStream in class BaseLobDomain

getInternalDataStream

protected java.io.InputStream getInternalDataStream()
Specified by:
getInternalDataStream in class BaseLobDomain

getInternalDataStream

protected java.io.InputStream getInternalDataStream(long pos,
                                                    long length)
Specified by:
getInternalDataStream in class BaseLobDomain

syncLob

protected void syncLob(java.lang.Object otherLob)
Specified by:
syncLob in class BaseLobDomain

getLength

public long getLength()
Returns the number of characters in the Clob value designated by this Clob object.
Specified by:
getLength in class BaseLobDomain
Returns:
length of the Clob in characters

getBufferSize

public int getBufferSize()
Get ideal LOB db access buffer size.
Returns:
the size in terms of characters.

closeOutputStream

public void closeOutputStream()
Description copied from interface: LobStreamInterface
Closes the OutputStream object. The OutputStream field is reset so that if getOutputStream() is called again, a new OutputStream is opened.
Specified by:
closeOutputStream in interface LobStreamInterface
Overrides:
closeOutputStream in class BaseLobDomain

closeCharacterOutputStream

public void closeCharacterOutputStream()
Description copied from interface: LobStreamInterface
Closes and cleansup internal reference to writer.
Specified by:
closeCharacterOutputStream in interface LobStreamInterface

getXMLContentNode

public Node getXMLContentNode(Document xmlDoc)
Creates the XML node in the given XML document for this domain's data.
Specified by:
getXMLContentNode in interface XMLDomainInterface
Parameters:
xmlDoc - name of the XML document.

printXMLDefinition

public java.lang.String printXMLDefinition(java.util.Hashtable allDefs,
                                           java.io.PrintWriter pw,
                                           boolean bContainees)
Prints the DTD information for this domain in the given print writer. Returns the DTD string to be added to this domain's container entity/domain.
Specified by:
printXMLDefinition in interface XMLDomainInterface
Parameters:
allDefs - name of hashtable containing key-value pairs of XML tags and their values.
pw - printwriter on which the information should be printed.
bContainees - whether this domain container has containees.

free

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

length

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

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 2 (11.1.2.3.0)

E17483-04


Copyright © 1997, 2012, Oracle. All rights reserved.