title: File downloading but without any contents in it
body: <p>I have a text file called output.txt that will generated inside D:/MPI. I have to download this file but the file which is getting downloaded is completely blank and does not have any contents. I want to download the file output.txt which is in the folder D:/MPI. Here is my code of JSP</p>
  
  <pre><code>&lt;%
  String filePath = "D://MPI//output.txt";
  String fileName = "outputs";
  FileInputStream fileToDownload = new FileInputStream(filePath);
  ServletOutputStream output = response.getOutputStream();
  response.setContentType("text/plain; charset=utf-8");
  response.setHeader("Content-Disposition","attachment; filename="+fileName);
  response.setContentLength(fileToDownload.available());
  int c;
  while((c=fileToDownload.read()) != -1){
  out.write(c);
  }
  output.flush();
  output.close();
  fileToDownload.close();
  %&gt;
  </code></pre>
  
  <p>Kindly guide me</p>