java.io.ByteArrayOutputStream is giving OutOfMemoryError when i am trying to upload a file greater than 2gb.
I checked the class and found the following code is causing the issue.
private static int hugeCapacity(int minCapacity) {
if (minCapacity < 0) // overflow
throw new OutOfMemoryError();
return (minCapacity > MAX_ARRAY_SIZE) ?
Integer.MAX_VALUE :
MAX_ARRAY_SIZE;
}
MAX_ARRAY_SIZE has been defined as: private static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8;
Is there a way to overcome this issue and upload the files of any size using this class? Or is there any other way to upload the file.