@Test
    public void testAppended() throws IOException {
        stream.reset();
        ByteWriter b = new ByteWriter(stream, encoder);
        final String s = "nalle";
        b.write(s);
        b.close();
        final byte[] bytes = Utf8.toBytes(s);
        assertArrayEquals(bytes, stream.toByteArray());
        assertEquals(bytes.length, b.appended());
    }
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