Package org.apache.ignite.internal.jdbc2
Class JdbcBlob
- java.lang.Object
-
- org.apache.ignite.internal.jdbc2.JdbcBlob
-
- All Implemented Interfaces:
Blob
public class JdbcBlob extends Object implements Blob
Simple BLOB implementation. Actually there is no such entity as BLOB in Ignite. So using arrays is a preferable way to work with binary objects.This implementation can be useful for writting and reading binary fields of objects through JDBC.
-
-
Constructor Summary
Constructors Constructor Description JdbcBlob()Create empty Blob.JdbcBlob(byte[] arr)Create Blob which wraps the existing byte array.JdbcBlob(JdbcBinaryBuffer buf)Create Blob which wraps the existing data stored in the buffer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfree()InputStreamgetBinaryStream()InputStreamgetBinaryStream(long pos, long len)byte[]getBytes(long pos, int len)longlength()longposition(byte[] ptrn, long start)longposition(Blob ptrn, long start)OutputStreamsetBinaryStream(long pos)intsetBytes(long pos, byte[] bytes)intsetBytes(long pos, byte[] bytes, int off, int len)voidtruncate(long len)
-
-
-
Constructor Detail
-
JdbcBlob
public JdbcBlob()
Create empty Blob.It's supposed to be called when client application creates Blob calling the
Connection.createBlob().
-
JdbcBlob
public JdbcBlob(JdbcBinaryBuffer buf)
Create Blob which wraps the existing data stored in the buffer.It's supposed to be called to create Blob for query result in the
ResultSet.- Parameters:
buf- Existing buffer with data.
-
JdbcBlob
public JdbcBlob(byte[] arr)
Create Blob which wraps the existing byte array.- Parameters:
arr- Byte array.
-
-
Method Detail
-
length
public long length() throws SQLException- Specified by:
lengthin interfaceBlob- Throws:
SQLException
-
getBytes
public byte[] getBytes(long pos, int len) throws SQLException- Specified by:
getBytesin interfaceBlob- Throws:
SQLException
-
getBinaryStream
public InputStream getBinaryStream() throws SQLException
- Specified by:
getBinaryStreamin interfaceBlob- Throws:
SQLException
-
getBinaryStream
public InputStream getBinaryStream(long pos, long len) throws SQLException
- Specified by:
getBinaryStreamin interfaceBlob- Throws:
SQLException
-
position
public long position(byte[] ptrn, long start) throws SQLException- Specified by:
positionin interfaceBlob- Throws:
SQLException
-
position
public long position(Blob ptrn, long start) throws SQLException
- Specified by:
positionin interfaceBlob- Throws:
SQLException
-
setBytes
public int setBytes(long pos, byte[] bytes) throws SQLException- Specified by:
setBytesin interfaceBlob- Throws:
SQLException
-
setBytes
public int setBytes(long pos, byte[] bytes, int off, int len) throws SQLException- Specified by:
setBytesin interfaceBlob- Throws:
SQLException
-
setBinaryStream
public OutputStream setBinaryStream(long pos) throws SQLException
- Specified by:
setBinaryStreamin interfaceBlob- Throws:
SQLException
-
truncate
public void truncate(long len) throws SQLException- Specified by:
truncatein interfaceBlob- Throws:
SQLException
-
free
public void free() throws SQLException- Specified by:
freein interfaceBlob- Throws:
SQLException
-
-