@Test
    public void testByteBuffers() throws java.io.IOException {
        stream.reset();
        ByteBuffer b = ByteBuffer.allocate(16);
        b.put((byte) 97);
        b.put((byte) 98);
        b.put((byte) 99);
        ByteWriter bw = new ByteWriter(stream, encoder);
        b.flip();
        bw.append(b);
        bw.close();
        byte[] res = stream.toByteArray();
        assertTrue(Arrays.equals(new byte[] { 97, 98, 99 }, res));
    }
A stream which does nothing, but complains if it is called and asked to
do nothing.
vespajlib/src/test/java/com/yahoo/io/ByteWriterTestCase.java