create B2Json version of ByteArrayOutputStream for B2Json API
throws IOException("Requested array size exceeds maximum limit") OutputStream requests array size over the limit (Integer.MAX_VALUE - 8)
Notes:
A subclass of B2JsonByteArrayOutputStream was created for testing with a smaller MAX_ARRAY_SIZE for throwing IOException("Requested array size exceeds maximum limit"). The original MAX_ARRAY_SIZE(Integer.MAX_VALUE - 8) was so large that we would throw an OutOfMemoryError first before even getting a chance to throw IOException with most typical JVM heap settings. (I managed to throw IOException with a larger heap size (>=3 GB) for unit testing B2JsonByteArrayOutputStream with it original MAX_ARRAY_SIZE)
The above fact means using B2JsonByteArrayOutputStream to catch and throw the intended IOException is of practical value probably only for JVMs with very large heap size.
Notes: A subclass of B2JsonByteArrayOutputStream was created for testing with a smaller MAX_ARRAY_SIZE for throwing IOException("Requested array size exceeds maximum limit"). The original MAX_ARRAY_SIZE(Integer.MAX_VALUE - 8) was so large that we would throw an OutOfMemoryError first before even getting a chance to throw IOException with most typical JVM heap settings. (I managed to throw IOException with a larger heap size (>=3 GB) for unit testing B2JsonByteArrayOutputStream with it original MAX_ARRAY_SIZE) The above fact means using B2JsonByteArrayOutputStream to catch and throw the intended IOException is of practical value probably only for JVMs with very large heap size.