setBytes(long pos, byte[] bytes, int offset, int len)

Syntax:

int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException

Description:

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.

Parameters:

pos

the position in the BLOB object at which to start writing; the first position is 1

bytes

the array of bytes to be written to this BLOB object

offset

the offset into the array bytes at which to start reading the bytes to be set

len

the number of bytes to be written to the BLOB value from the array of bytes bytes

Returns:

the number of bytes written

Throws:

SQLException - if a database access error occurs, pos < 1, bytes is null, offset < 0, len < 0 or offset + len > bytes.length

References:

For more information, reference JDBC documentation for: Blob.setBytes(long, byte[], int, int)