When I use a very large file, the error happens out of memory, no way to treat this problem, or why not be happening in the code below?
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    //10*1024 = 10KB
    byte[] byteBuffer   = new byte[20*2048]; 
    int i = Integer.MAX_VALUE;
    while ((i = is.read(byteBuffer, 0, byteBuffer.length)) > 0) {
        baos.write(byteBuffer, 0, i);
    }
    return baos.toByteArray(); 
 
    