Replace ByteArrayOutputStreams with ByteBuffer and remove IOException from method signatrues

ByteBuffer is more efficient than BAOS and these changes should produce improved performance results.