I have a ByteArrayOutputStream object that causes the following error:
java.lang.ArrayIndexOutOfBoundsException at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:113)
I am trying to upload a file consisting of several concerts by writing bytes [] of fragments of 250 MB each one at a time.
I can observe how the byte grows in size and as soon as it reaches a length of 2147483647, the upper limit is int, it explodes on the following line:
stream.write(buf);
stream - ByteArrayOutputStream, buf is what I write to the stream in 250 MB blocks.
I planned to do
byte result[] = stream.toByteArray();
At the end. Is there another method that I can try that will support byte array sizes exceeding the upper limit of int?
Brian source share