Javadoc for ByteArrayOutputStream states this is the initial capacity of the buffer. The default is only 32 bytes. We probably need more than that for most messages so I set the default to 128 bytes for this usage. It will double in size until either JVM heap is exhausted, or the message is done being created.