org.hibernate.engine.jdbc
Class ClobProxy

java.lang.Object
  extended by org.hibernate.engine.jdbc.ClobProxy
All Implemented Interfaces:
InvocationHandler
Direct Known Subclasses:
NClobProxy

public class ClobProxy
extends Object
implements InvocationHandler

Manages aspects of proxying Clobs for non-contextual creation, including proxy creation and handling proxy invocations.


Constructor Summary
protected ClobProxy(Reader reader, long length)
          Constructor used to build Clob from a reader.
protected ClobProxy(String string)
          Constructor used to build Clob from string data.
 
Method Summary
static Clob generateProxy(Reader reader, long length)
          Generates a Clob proxy using a character reader of given length.
static Clob generateProxy(String string)
          Generates a Clob proxy using the string data.
protected  InputStream getAsciiStream()
           
protected  Reader getCharacterStream()
           
protected  long getLength()
           
protected static ClassLoader getProxyClassLoader()
          Determines the appropriate class loader to which the generated proxy should be scoped.
protected  String getSubString(long start, int length)
           
 Object invoke(Object proxy, Method method, Object[] args)
          
protected  void resetIfNeeded()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClobProxy

protected ClobProxy(String string)
Constructor used to build Clob from string data.

Parameters:
string - The byte array
See Also:
generateProxy(String)

ClobProxy

protected ClobProxy(Reader reader,
                    long length)
Constructor used to build Clob from a reader.

Parameters:
reader - The character reader.
length - The length of the reader stream.
See Also:
generateProxy(java.io.Reader, long)
Method Detail

getLength

protected long getLength()

getAsciiStream

protected InputStream getAsciiStream()
                              throws SQLException
Throws:
SQLException

getCharacterStream

protected Reader getCharacterStream()
                             throws SQLException
Throws:
SQLException

getSubString

protected String getSubString(long start,
                              int length)

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable

Specified by:
invoke in interface InvocationHandler
Throws:
UnsupportedOperationException - if any methods other than Clob.length(), Clob.getAsciiStream(), or Clob.getCharacterStream() are invoked.
Throwable

resetIfNeeded

protected void resetIfNeeded()
                      throws SQLException
Throws:
SQLException

generateProxy

public static Clob generateProxy(String string)
Generates a Clob proxy using the string data.

Parameters:
string - The data to be wrapped as a Clob.
Returns:
The generated proxy.

generateProxy

public static Clob generateProxy(Reader reader,
                                 long length)
Generates a Clob proxy using a character reader of given length.

Parameters:
reader - The character reader
length - The length of the character reader
Returns:
The generated proxy.

getProxyClassLoader

protected static ClassLoader getProxyClassLoader()
Determines the appropriate class loader to which the generated proxy should be scoped.

Returns:
The class loader appropriate for proxy construction.


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.