I think there is agreement that ByteArrayOutputStream.unsynchronized(int cap) 
(or some such method) would be useful. It would not require using a contiguous 
byte[] as the backing array so there is scope to experiment with 
implementations that don't need to resize like the base BAOS does.

Extending BOAS means the size is limited to an int. To go beyond would be a 
different API and there is lots of scope to do experiments. I think too early 
to create a CSR for MOS, assuming this is what you mean.

  Thank you Alan!  PR [1] is updated with the factory method as suggested; MOS 
is a package-private subclass of BAOS and the Javadoc in BAOS makes no promises 
about the implementation returned.  I allowed MOS to grow beyond 2GB and throw 
an intelligent error if it cannot service a particular call (toByteArray, size, 
etc.).  Performance is unchanged.  Feedback appreciated.
  Thanks!  😊
     John

[1] https://github.com/openjdk/jdk/pull/24232

Reply via email to