@Test public void testCopyTo() throws Exception { byte[] bytes = new byte[bytes1.length]; blob1.copyTo(bytes); assertArrayEquals(bytes1, bytes); ByteBuffer buffer = ByteBuffer.allocate(bytes1.length); blob1.copyTo(buffer); buffer.flip(); bytes = new byte[bytes1.length]; buffer.get(bytes); assertFalse(buffer.hasRemaining()); assertArrayEquals(bytes1, bytes); }