Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Sunday, 15 December 2019

Issues when download file with more than 2GB in Java

Use below code to download content with more than 2 GB



    long length = fileObj.length();
    if (length <= Integer.MAX_VALUE)
    {
      response.setContentLength((int)length);
    }
    else
    {
      response.addHeader("Content-Length", Long.toString(length));
    }