OpenAPI 1.0

com.aquafold.openapi.rdbms
Interface AQSQLBlob


public interface AQSQLBlob

This class describes a SQL BLOB object.


Method Summary
 void free()
          This method frees the Blob object and releases the resources that it holds.
 byte[] getBytes(long pos, int length)
          Retrieves all or part of the BLOB value that this Blob object represents, as an array of bytes.
 long getLength()
          Retrieves the length of the blob.
 int setBytes(long pos, byte[] bytes)
          Writes the given array of bytes to the BLOB value that this Blob object represents, starting at position pos, and returns the number of bytes written.
 int setBytes(long pos, byte[] bytes, int offset, int length)
          Writes all or part of the given byte array to the BLOB value that this Blob object represents and returns the number of bytes written.
 

Method Detail

free

void free()
          throws Exception
This method frees the Blob object and releases the resources that it holds. The object is invalid once the free method is called.

Throws:
Exception - If an error occurs releasing the Blob's resources.
If the method is not supported by the database vendor.

getBytes

byte[] getBytes(long pos,
                int length)
                throws Exception
Retrieves all or part of the BLOB value that this Blob object represents, as an array of bytes. This byte array contains up to length consecutive bytes starting at position pos.

Parameters:
pos - The ordinal position of the first byte in the BLOB value to be extracted; the first byte is at position 0.
length - The number of consecutive bytes to be copied; the value for length must be 0 or greater.
Returns:
A byte array containing up to length consecutive bytes from the BLOB value designated by this Blob object, starting with the byte at position pos.
Throws:
If - there is an error accessing the BLOB value; if pos is less than 1 or length is less than 0.
Exception

getLength

long getLength()
               throws Exception
Retrieves the length of the blob.

Returns:
A long value representing the size of the blob.
Throws:
Exception - If there is an error accessing the length of the BLOB.

setBytes

int setBytes(long pos,
             byte[] bytes)
             throws Exception
Writes the given array of bytes to the BLOB value that this Blob object represents, starting at position pos, and returns the number of bytes written. The array of bytes will overwrite the existing bytes in the Blob object starting at the position pos. If the end of the Blob value is reached while writing the array of bytes, then the length of the Blob value will be increased to accommodate the extra bytes.

Note: If the value specified for pos is greater then the length+1 of the BLOB value then the behavior is undefined. Some JDBC drivers may throw a SQLException while other drivers may support this operation.

Parameters:
pos - The position in the BLOB object at which to start writing; the first position is 0.
bytes - The array of bytes to be written to the BLOB value that this Blob object represents.
Returns:
The number of bytes written.
Throws:
If - there is an error accessing the BLOB value or if pos is less than 0.
Exception

setBytes

int setBytes(long pos,
             byte[] bytes,
             int offset,
             int length)
             throws Exception
Writes all or part of the given byte array to the BLOB value that this Blob object represents and returns the number of bytes written. Writing starts at position pos in the BLOB value; len bytes from the given byte array are written. The array of bytes will overwrite the existing bytes in the Blob object starting at the position pos. If the end of the Blob value is reached while writing the array of bytes, then the length of the Blob value will be increased to accommodate the extra bytes.

Note: If the value specified for pos is greater then the length+1 of the BLOB value then the behavior is undefined.

Parameters:
pos - The position in the BLOB object at which to start writing; the first position is 0.
bytes - The array of bytes to be written to the BLOB value that this Blob object represents.
offset - The offset into the array bytes at which to start reading the bytes to be set
length - The number of bytes to be written to the BLOB value from the array of bytes.
Returns:
The number of bytes written.
Throws:
If - there is an error accessing the BLOB value or if pos is less than 0.
Exception

OpenAPI 1.0


Copyright © 2010 AquaFold, Inc. All Rights Reserved. Use is subject to license terms.