@Override public byte[] getBlob(int columnIndex) { return window.getBlob(position, columnIndex); }
@Test public void shouldFillWindowWithCursor() throws Exception { CursorWindow window = new CursorWindow("name"); MatrixCursor testCursor = new MatrixCursor(new String[] { "a", "b", "c", "d"}); testCursor.addRow(new Object[] { 12, "hello", null, new byte[] {(byte) 0xba, (byte) 0xdc, (byte) 0xaf, (byte) 0xfe} }); testCursor.addRow(new Object[] { 34, "baz", 1.2, null }); testCursor.addRow(new Object[] { 46, "foo", 2.4, new byte[]{} }); DatabaseUtils.cursorFillWindow(testCursor, 0, window); assertThat(window.getNumRows()).isEqualTo(3); assertThat(window.getInt(0, 0)).isEqualTo(12); assertThat(window.getString(0, 1)).isEqualTo("hello"); assertThat(window.getString(0, 2)).isNull(); assertThat(window.getBlob(0, 3)).isEqualTo(new byte[] {(byte) 0xba, (byte) 0xdc, (byte) 0xaf, (byte) 0xfe}); assertThat(window.getInt(1, 0)).isEqualTo(34); assertThat(window.getString(1, 1)).isEqualTo("baz"); assertThat(window.getFloat(1, 2)).isEqualTo(1.2f); assertThat(window.getBlob(1, 3)).isEqualTo(null); assertThat(window.getBlob(2, 3)).isEqualTo(new byte[]{}); } }
@Override public byte[] getBlob(int columnIndex) { return window.getBlob(position, columnIndex); }
@Override public byte[] getBlob(int columnIndex) { return window.getBlob(position, columnIndex); }
@Override public byte[] getBlob(int columnIndex) { return window.getBlob(position, columnIndex); }
/** * Retrieves the byte array value for a given column at the provided position. * This will throw an {@link IllegalArgumentException} if the column does not exist, the * position is invalid, or the data holder has been closed. * * @param column The column to retrieve. * @param row The row to retrieve the data from. * @param windowIndex Index of the cursor window to extract the data from. * @return The byte array value in that column. */ public byte[] getByteArray(String column, int row, int windowIndex) { return windows[windowIndex].getBlob(row, columnIndices.get(column)); }
byte[] cur = origin.getBlob(i, j); destination.putBlob(cur, i, j);
byte[] cur = origin.getBlob(i, j); destination.putBlob(cur, i, j);