org.sqlite
Class Blob

java.lang.Object
  extended by org.sqlite.Blob
All Implemented Interfaces:
Closeable

public class Blob
extends java.lang.Object
implements Closeable

sqlite3_blob wrapper class.
NOTE: SQLite 3.5.7 based.

See Also:
A Handle To An Open BLOB, Database.openBlob(java.lang.String, java.lang.String, java.lang.String, long, int)

Method Summary
 void close()
          invoke sqlite3_blob_close() function.
 boolean isClosed()
          Retrieves whether this object has been closed.
 int length()
          invoke sqlite3_blob_bytes() function.
 void read(byte[] b, int len, int offset)
          invoke sqlite3_blob_read() function.
 void write(byte[] b, int len, int offset)
          invoke sqlite3_blob_write() function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isClosed

public boolean isClosed()
Description copied from interface: Closeable
Retrieves whether this object has been closed.

Specified by:
isClosed in interface Closeable
Returns:
true if this object is closed; false if it is still open

close

public void close()
           throws java.sql.SQLException
invoke sqlite3_blob_close() function.

Specified by:
close in interface Closeable
Throws:
java.sql.SQLException - When the return value of the sqlite3_blob_close() function is not SQLITE_OK.
See Also:
Close A BLOB Handle

length

public int length()
           throws java.sql.SQLException
invoke sqlite3_blob_bytes() function.

Returns:
the size of an open blob.
Throws:
java.sql.SQLException - When this method is called on a closed blob.
See Also:
Return The Size Of An Open BLOB

read

public void read(byte[] b,
                 int len,
                 int offset)
          throws java.sql.SQLException
invoke sqlite3_blob_read() function.

Parameters:
b - the buffer into which the data is read.
len - the maximum number of bytes to read.
offset - the start offset in BLOB at which the data is read.
Throws:
java.sql.SQLException - When this method is called on a closed blob. When the return value of the sqlite3_blob_read() function is not SQLITE_OK.
See Also:
Read Data From A BLOB Incrementally

write

public void write(byte[] b,
                  int len,
                  int offset)
           throws java.sql.SQLException
invoke sqlite3_blob_write() function.

Parameters:
b - the data.
len - the number of bytes to write.
offset - the start offset in the BLOB.
Throws:
java.sql.SQLException - When the return value of the sqlite3_blob_write() function is not SQLITE_OK.
See Also:
Write Data Into A BLOB Incrementally