we could subclass ByteArrayOutputStream to get access to the buffer