/** * Open an SQLite3 blob. Only available in SQLite 3.4.0 and above. * @param db database name * @param table table name * @param column column name * @param row row identifier * @param rw if true, open for read-write, else read-only * @return a Blob object */ public Blob open_blob(String db, String table, String column, long row, boolean rw) throws SQLite.Exception { synchronized(this) { Blob blob = new Blob(); _open_blob(db, table, column, row, rw, blob); return blob; } }
/** * Close this blob InputStream. */ public void close() throws IOException { blob.close(); blob = null; pos = 0; }
/** * Read byte array from blob. * @param b byte array to be filled * @return number of bytes read */ public int read(byte b[]) throws IOException { int n = blob.read(b, 0, pos, b.length); if (n > 0) { pos += n; return n; } return -1; }
/** * Write blob data. * @param v byte to be written at current position. */ public void write(int v) throws IOException { byte b[] = new byte[1]; b[0] = (byte) v; pos += blob.write(b, 0, pos, 1); }
/** * Write blob data. * @param b byte array to be written at current position. */ public void write(byte[] b) throws IOException { if (b != null && b.length > 0) { pos += blob.write(b, 0, pos, b.length); } }
/** * Write blob data. * @param b byte array to be written. * @param off offset within byte array * @param len length of data to be written */ public void write(byte[] b, int off, int len) throws IOException { if (b != null) { if (off + len > b.length) { len = b.length - off; } if (len <= 0) { return; } pos += blob.write(b, off, pos, len); } } }
/** * Read single byte from blob. * @return byte read */ public int read() throws IOException { byte b[] = new byte[1]; int n = blob.read(b, 0, pos, b.length); if (n > 0) { pos += n; return b[0]; } return -1; }
/** * Close this blob OutputStream. */ public void close() throws IOException { blob.close(); blob = null; pos = 0; }
/** * Open an SQLite3 blob. Only available in SQLite 3.4.0 and above. * @param db database name * @param table table name * @param column column name * @param row row identifier * @param rw if true, open for read-write, else read-only * @return a Blob object */ public Blob open_blob(String db, String table, String column, long row, boolean rw) throws SQLite.Exception { synchronized(this) { Blob blob = new Blob(); _open_blob(db, table, column, row, rw, blob); return blob; } }
/** * Write blob data. * @param b byte array to be written at current position. */ public void write(byte[] b) throws IOException { if (b != null && b.length > 0) { pos += blob.write(b, 0, pos, b.length); } }
/** * Read slice of byte array from blob. * @param b byte array to be filled * @param off offset into byte array * @param len length to be read * @return number of bytes read */ public int read(byte b[], int off, int len) throws IOException { if (off + len > b.length) { len = b.length - off; } if (len < 0) { return -1; } if (len == 0) { return 0; } int n = blob.read(b, off, pos, len); if (n > 0) { pos += n; return n; } return -1; } }
/** * Close this blob OutputStream. */ public void close() throws IOException { blob.close(); blob = null; pos = 0; }
/** * Open an SQLite3 blob. Only available in SQLite 3.4.0 and above. * @param db database name * @param table table name * @param column column name * @param row row identifier * @param rw if true, open for read-write, else read-only * @return a Blob object */ public Blob open_blob(String db, String table, String column, long row, boolean rw) throws SQLite.Exception { synchronized(this) { Blob blob = new Blob(); _open_blob(db, table, column, row, rw, blob); return blob; } }
/** * Write blob data. * @param b byte array to be written at current position. */ public void write(byte[] b) throws IOException { if (b != null && b.length > 0) { pos += blob.write(b, 0, pos, b.length); } }
/** * Read byte array from blob. * @param b byte array to be filled * @return number of bytes read */ public int read(byte b[]) throws IOException { int n = blob.read(b, 0, pos, b.length); if (n > 0) { pos += n; return n; } return -1; }
/** * Close this blob InputStream. */ public void close() throws IOException { blob.close(); blob = null; pos = 0; }
/** * Open an SQLite3 blob. Only available in SQLite 3.4.0 and above. * @param db database name * @param table table name * @param column column name * @param row row identifier * @param rw if true, open for read-write, else read-only * @return a Blob object */ public Blob open_blob(String db, String table, String column, long row, boolean rw) throws SQLite.Exception { synchronized(this) { Blob blob = new Blob(); _open_blob(db, table, column, row, rw, blob); return blob; } }
/** * Write blob data. * @param b byte array to be written at current position. */ public void write(byte[] b) throws IOException { if (b != null && b.length > 0) { pos += blob.write(b, 0, pos, b.length); } }
/** * Read byte array from blob. * @param b byte array to be filled * @return number of bytes read */ public int read(byte b[]) throws IOException { int n = blob.read(b, 0, pos, b.length); if (n > 0) { pos += n; return n; } return -1; }
/** * Close this blob InputStream. */ public void close() throws IOException { blob.close(); blob = null; pos = 0; }