Package org.hibernate.engine.jdbc
Class BlobProxy
- java.lang.Object
-
- org.hibernate.engine.jdbc.BlobProxy
-
- All Implemented Interfaces:
java.sql.Blob
,BlobImplementer
public final class BlobProxy extends java.lang.Object implements java.sql.Blob, BlobImplementer
Manages aspects of representingBlob
objects. 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 void
free()
static java.sql.Blob
generateProxy(byte[] bytes)
Generates a BlobImpl using byte data.static java.sql.Blob
generateProxy(java.io.InputStream stream, long length)
Generates a BlobImpl proxy using a given number of bytes from an InputStream.java.io.InputStream
getBinaryStream()
java.io.InputStream
getBinaryStream(long start, long length)
byte[]
getBytes(long start, int length)
BinaryStream
getUnderlyingStream()
Gets access to the data underlying this BLOB.long
length()
long
position(byte[] pattern, long start)
long
position(java.sql.Blob pattern, long start)
java.io.OutputStream
setBinaryStream(long pos)
int
setBytes(long pos, byte[] bytes)
int
setBytes(long pos, byte[] bytes, int offset, int len)
void
truncate(long len)
-
-
-
Method Detail
-
getUnderlyingStream
public BinaryStream getUnderlyingStream() throws java.sql.SQLException
Description copied from interface:BlobImplementer
Gets access to the data underlying this BLOB.- Specified by:
getUnderlyingStream
in interfaceBlobImplementer
- Returns:
- Access to the underlying data.
- Throws:
java.sql.SQLException
-
generateProxy
public static java.sql.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 java.sql.Blob generateProxy(java.io.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 java.sql.SQLException
- Specified by:
length
in interfacejava.sql.Blob
- Throws:
java.sql.SQLException
-
getBytes
public byte[] getBytes(long start, int length) throws java.sql.SQLException
- Specified by:
getBytes
in interfacejava.sql.Blob
- Throws:
java.sql.SQLException
-
getBinaryStream
public java.io.InputStream getBinaryStream() throws java.sql.SQLException
- Specified by:
getBinaryStream
in interfacejava.sql.Blob
- Throws:
java.sql.SQLException
-
position
public long position(byte[] pattern, long start)
- Specified by:
position
in interfacejava.sql.Blob
-
position
public long position(java.sql.Blob pattern, long start)
- Specified by:
position
in interfacejava.sql.Blob
-
setBytes
public int setBytes(long pos, byte[] bytes)
- Specified by:
setBytes
in interfacejava.sql.Blob
-
setBytes
public int setBytes(long pos, byte[] bytes, int offset, int len)
- Specified by:
setBytes
in interfacejava.sql.Blob
-
setBinaryStream
public java.io.OutputStream setBinaryStream(long pos)
- Specified by:
setBinaryStream
in interfacejava.sql.Blob
-
truncate
public void truncate(long len)
- Specified by:
truncate
in interfacejava.sql.Blob
-
free
public void free()
- Specified by:
free
in interfacejava.sql.Blob
-
getBinaryStream
public java.io.InputStream getBinaryStream(long start, long length) throws java.sql.SQLException
- Specified by:
getBinaryStream
in interfacejava.sql.Blob
- Throws:
java.sql.SQLException
-
-