I have a ByteArrayOutputStream object that I'm getting the following error for:
java.lang.ArrayIndexOutOfBoundsException at
java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:113)
I am trying to load a file that is several gigs into it by writing byte[] chunks of 250mb one at a time.
I can watch the byte grow in size and as soon as it hits length 2147483647, the upper limit of int, it blows up on the following line:
stream.write(buf);
stream is the ByteArrayOutputStream, buf is what I'm writing to the stream in 250mb chunks.
I was planning to do
byte result[] = stream.toByteArray();
At the end. Is there some other method I can try that will support byte array sizes greater than the int upper limit?