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