PublicBufferOutputStream.getBuffer() returns the buffer directly,
whereas ByteArrayOutputStream.toByteArray() creates a copy of the
internal buffer. So by using PublicBufferOutputStream we save one
allocation of a byte array per write.

That seems like a strong enough reason to favor PublicBufferOutputStream, to me.

thanks,

bryan

Reply via email to