org.eclipse.datatools.connectivity.oda
Interface IBlob


public interface IBlob

An optional interface that represents a Binary Large Object (BLOB) value.
The interface must be implemented only if the ODA driver supports the BLOB data type.

The IBlob interface provides methods for retrieving a BLOB value as a Java input stream that can be read in smaller chunks, and for optionally getting the length of a BLOB value.
The interface method IResultSet.getBlob returns an IBlob instance.

Since:
3.0

Method Summary
 java.io.InputStream getBinaryStream()
          Retrieves the BLOB value designated by this IBlob instance as a binary stream of uninterpreted bytes.
 byte[] getBytes(long position, int length)
          Retrieves all or part of the BLOB value designated by this IBlob instance as an array of bytes.
 long length()
          Returns the number of bytes in the BLOB value designated by this IBlob object.
 

Method Detail

getBinaryStream

java.io.InputStream getBinaryStream()
                                    throws OdaException
Retrieves the BLOB value designated by this IBlob instance as a binary stream of uninterpreted bytes.

Returns:
a Java input stream that delivers the BLOB data as a stream of uninterpreted bytes
Throws:
OdaException - if data source error occurs

getBytes

byte[] getBytes(long position,
                int length)
                throws OdaException
Retrieves all or part of the BLOB value designated by this IBlob instance as an array of bytes.
An optional short-cut method to retrieve from the instance's binary stream. The ODA consumer helper framework provides default implementation, which is used when an ODA driver throws an UnsupportedOperationException. An ODA driver is however encouraged to provide a more efficient implementation of this method.

Parameters:
position - the 1-based ordinal position of the first byte in the BLOB value to be extracted
length - the number of consecutive bytes to be copied; a negative value means to copy all remaining bytes available in the binary stream
Returns:
a byte array containing up to length consecutive bytes from the BLOB value, starting with the byte at position
Throws:
OdaException - if data source error occurs

length

long length()
            throws OdaException
Returns the number of bytes in the BLOB value designated by this IBlob object. An optional method; throws UnsupportedOperationException if a driver does not support retrieving the length.

Returns:
length of the BLOB value in bytes
Throws:
OdaException - if data source error occurs