Package org.hibernate.engine.jdbc
Class BlobProxy
- java.lang.Object
-
- org.hibernate.engine.jdbc.BlobProxy
-
- All Implemented Interfaces:
Blob,BlobImplementer
public final class BlobProxy extends Object implements Blob, BlobImplementer
Manages aspects of representingBlobobjects. In previous versions this used to be implemented by using a java.lang.reflect.Proxy to deal with incompatibilities across various JDBC versions, hence the class name, but using a real Proxy is no longer necessary. The class name could be updated to reflect this but that would break APIs, so this operation is deferred.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfree()static BlobgenerateProxy(byte[] bytes)Generates a BlobImpl using byte data.static BlobgenerateProxy(InputStream stream, long length)Generates a BlobImpl proxy using a given number of bytes from an InputStream.InputStreamgetBinaryStream()InputStreamgetBinaryStream(long start, long length)byte[]getBytes(long start, int length)BinaryStreamgetUnderlyingStream()Gets access to the data underlying this BLOB.longlength()longposition(byte[] pattern, long start)longposition(Blob pattern, long start)OutputStreamsetBinaryStream(long pos)intsetBytes(long pos, byte[] bytes)intsetBytes(long pos, byte[] bytes, int offset, int len)voidtruncate(long len)
-
-
-
Method Detail
-
getUnderlyingStream
public BinaryStream getUnderlyingStream() throws SQLException
Description copied from interface:BlobImplementerGets access to the data underlying this BLOB.- Specified by:
getUnderlyingStreamin interfaceBlobImplementer- Returns:
- Access to the underlying data.
- Throws:
SQLException
-
generateProxy
public static Blob generateProxy(byte[] bytes)
Generates a BlobImpl using byte data.- Parameters:
bytes- The data to be created as a Blob.- Returns:
- The BlobProxy instance to represent this data.
-
generateProxy
public static Blob generateProxy(InputStream stream, long length)
Generates a BlobImpl proxy using a given number of bytes from an InputStream.- Parameters:
stream- The input stream of bytes to be created as a Blob.length- The number of bytes from stream to be written to the Blob.- Returns:
- The BlobProxy instance to represent this data.
-
length
public long length() throws SQLException- Specified by:
lengthin interfaceBlob- Throws:
SQLException
-
getBytes
public byte[] getBytes(long start, int length) throws SQLException- Specified by:
getBytesin interfaceBlob- Throws:
SQLException
-
getBinaryStream
public InputStream getBinaryStream() throws SQLException
- Specified by:
getBinaryStreamin interfaceBlob- Throws:
SQLException
-
setBytes
public int setBytes(long pos, byte[] bytes, int offset, int len)
-
setBinaryStream
public OutputStream setBinaryStream(long pos)
- Specified by:
setBinaryStreamin interfaceBlob
-
getBinaryStream
public InputStream getBinaryStream(long start, long length) throws SQLException
- Specified by:
getBinaryStreamin interfaceBlob- Throws:
SQLException
-
-