Package org.hibernate.engine.jdbc
Class ClobProxy
- java.lang.Object
-
- org.hibernate.engine.jdbc.ClobProxy
-
- All Implemented Interfaces:
InvocationHandler
- Direct Known Subclasses:
NClobProxy
@Internal public class ClobProxy extends Object implements InvocationHandler
Manages aspects of proxyingClob
s for non-contextual creation, including proxy creation and handling proxy invocations. We use proxies here solely to avoid JDBC version incompatibilities.- See Also:
NClobProxy
,BlobProxy
,LobCreator
,LobHelper
- API Note:
- This class is not intended to be called directly by the application program.
Instead, use
Session.getLobHelper()
.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Clob
generateProxy(Reader reader, long length)
Generates aClob
proxy using a character reader of given length.static Clob
generateProxy(String string)
Generates aClob
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)
protected CharacterStream
getUnderlyingStream()
Object
invoke(Object proxy, Method method, Object[] args)
protected void
resetIfNeeded()
-
-
-
Constructor Detail
-
ClobProxy
protected ClobProxy(String string)
Constructor used to buildClob
from string data.- Parameters:
string
- The byte array- See Also:
generateProxy(String)
-
ClobProxy
protected ClobProxy(Reader reader, long length)
Constructor used to buildClob
from a reader.- Parameters:
reader
- The character reader.length
- The length of the reader stream.- See Also:
generateProxy(Reader, long)
-
-
Method Detail
-
getLength
protected long getLength()
-
getAsciiStream
protected InputStream getAsciiStream() throws SQLException
- Throws:
SQLException
-
getCharacterStream
protected Reader getCharacterStream() throws SQLException
- Throws:
SQLException
-
getUnderlyingStream
protected CharacterStream getUnderlyingStream() 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 interfaceInvocationHandler
- Throws:
UnsupportedOperationException
- if any methods other thanClob.length()
,Clob.getAsciiStream()
,Clob.getCharacterStream()
,ClobImplementer.getUnderlyingStream()
,Clob.getSubString(long, int)
,Clob.free()
, or toString/equals/hashCode are invoked.Throwable
-
resetIfNeeded
protected void resetIfNeeded() throws SQLException
- Throws:
SQLException
-
generateProxy
public static Clob generateProxy(String string)
Generates aClob
proxy using the string data.- Parameters:
string
- The data to be wrapped as aClob
.- Returns:
- The generated proxy.
-
generateProxy
public static Clob generateProxy(Reader reader, long length)
Generates aClob
proxy using a character reader of given length.- Parameters:
reader
- The character readerlength
- 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.
-
-