@Override public void write(byte[] b) throws IOException { write(b, 0, b.length); }
private ByteBuffer write(final ByteBuffer bb, final byte [] bytes) throws IOException { try (ByteBufferOutputStream bbos = new ByteBufferOutputStream(bb)) { bbos.write(bytes); assertTrue(Bytes.compareTo(bytes, bbos.toByteArray(0, bytes.length)) == 0); bbos.flush(); return bbos.getByteBuffer(); } } }
@Override public void write(byte[] b) throws IOException { write(b, 0, b.length); }
@Override public void write(byte[] b) throws IOException { write(b, 0, b.length); }
private ByteBuffer write(final ByteBuffer bb, final byte [] bytes) throws IOException { try (ByteBufferOutputStream bbos = new ByteBufferOutputStream(bb)) { bbos.write(bytes); assertTrue(Bytes.compareTo(bytes, bbos.toByteArray(0, bytes.length)) == 0); bbos.flush(); return bbos.getByteBuffer(); } } }