superwaba.ext.xplat.sql
Class Blob

java.lang.Object
  |
  +--superwaba.ext.xplat.sql.Blob

public abstract class Blob
extends Object

This interface specified methods for accessing a SQL BLOB (Binary Large OBject) type. This object has been greatly simplified for SW. WARNING: In SuperWaba, it is allowable for a ResultSet to optimize access by reusing the same instance of the Blob object across calls to getBlob(..) This means that the content of a Blob object is valid only until getBlob(..) is called again. It is up to the developer to copy this data if it is needed across multiple calls to getBlob(..)

Since:
1.2

Constructor Summary
Blob()
           
 
Method Summary
abstract  byte[] getByteBuffer()
          This method returns a byte array that may be larger than the actual data retrieved.
abstract  byte[] getBytes(long pos, int length)
          This method returns up to the requested bytes of this BLOB as a byte array.
abstract  long length()
          This method returns the number of bytes in the BLOB.
abstract  int setBytes(long pos, byte[] bytes)
           
abstract  int setBytes(long pos, byte[] bytes, int offset, int len)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, toString, wait, wait
 

Constructor Detail

Blob

public Blob()
Method Detail

length

public abstract long length()
                     throws SQLException
This method returns the number of bytes in the BLOB.
Returns:
The number of bytes in the BLOB.
Throws:
SQLException - If an error occurs.

getBytes

public abstract byte[] getBytes(long pos,
                                int length)
                         throws SQLException
This method returns up to the requested bytes of this BLOB as a byte array.
Parameters:
pos - The index into the BLOB to start returning bytes from.
length - The requested number of bytes to return.
Returns:
The requested bytes from the BLOB.
Throws:
SQLException - If an error occurs.

getByteBuffer

public abstract byte[] getByteBuffer()
                              throws SQLException
This method returns a byte array that may be larger than the actual data retrieved. The caller of this method must be sure to limit their access to only the portion of the byte array that was actually retrieved. That is, the element indices of 0 to Blob.length() - 1. This method is unique to SuperWaba and was added to allow for column binding optimization (to avoid creating a new byte array as getBytes must usually do). There is no promise given that this will be more effecient. It is dependent on the driver implementation, but it should never be less effecient than calling getBytes(0, blob.getLength()).
Returns:
The internal byte buffer used for the BLOB.
Throws:
SQLException - if an error occurs.

setBytes

public abstract int setBytes(long pos,
                             byte[] bytes)
                      throws SQLException
Throws:
SQLException - If an error occurs.
Since:
1.4

setBytes

public abstract int setBytes(long pos,
                             byte[] bytes,
                             int offset,
                             int len)
                      throws SQLException
Throws:
SQLException - If an error occurs.
Since:
1.4