i have used a java code to download a file from a server and after the file is downloaded the file gets deleted from the server. The total size of file is 200gb. the downloading starts and shows download successful. when i check the downloaded file size its only 3.3 gb. and also the file does not get deleted. i have checked the error logs but there is no log. here is my code.
byte b[] = new byte[2048];
int len = 0;
filein = new BufferedInputStream(new FileInputStream(file));
output = new BufferedOutputStream(response.getOutputStream());
response.setContentType("application/force-download");
response.setHeader("content-Disposition", "attachment; filename=" + fname); // downloaded file name
response.setHeader("content-Transfer-Encoding", "binary");
while ((len = filein.read(b)) > 0) {
output.write(b, 0, len);
output.flush();
}
output.close();
filein.close();
file.delete(); // delete file
please suggest what i am missing..