@Override
    public void write(byte[] b) throws IOException {
        checkPreBufferSize(b.length);

        if (postBuffer != null) {
            postBuffer.write(b);
        } else {
            System.arraycopy(b, 0, preBuffer, preBufferPos, b.length);
            preBufferPos = preBufferPos + b.length;
        }

    }
An output stream buffer that tries to use a given buffer first and once that
is not big enough it delegates all calls to a real ByteArrayOutputStream.
<p>
It also allows access to the buffer and pos without a copy of the array.
stroom-util/src/main/java/stroom/util/io/InitialByteArrayOutputStream.java