I'm trying to download file of size > 2 GB (of .tar.gz format).
code:
try (InputStream fileInputStream = new FileInputStream(file)){
output = response.getOutputStream();
response.setContentType("application/gzip");
response.setContentLength((int) (file.length()));
response.setHeader("Content-Disposition", "attachment; filename=\"" + file.getName() + "\"");
IOUtils.copyLarge(fileInputStream, output);
output.flush();
if(fileInputStream != null) {
fileInputStream.close();
}
}
but getting below error.
2019-06-12 14:38:24,840 ERROR [https-jsse-nio-8543-exec-1]-rest.LogBundlesAPI: downloadLogBundle--> Exception occured while reading log bundle in download log bundle REST call.org.apache.catalina.connector.ClientAbortException: java.io.IOException: Connection reset by peer
Why above error & Is there any other way to download file of any size in Java?