@Test
    public void testByteArrayWithOffset() throws java.io.IOException {
        final int length = BufferChain.BUFFERSIZE * 3 / 2;
        final int offset = 1;
        final byte invalid = 3;
        final byte valid = 2;
        stream.reset();
        byte[] c = new byte[length];
        c[0] = invalid;
        for (int i = offset; i < length; ++i) {
            c[i] = valid;
        }
        ByteWriter bw = new ByteWriter(stream, encoder);
        bw.append(c, offset, length - offset);
        bw.close();
        byte[] res = stream.toByteArray();
        assertEquals(length - offset, res.length);
        assertEquals(valid, res[0]);
    }
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