I stuck into a problem.
- I started downloading a file from torrent. the Total Size of the
File is 699 MB. - But after a minute i stop my torrent client, torrent client shows 7
MB of data has been downloaded, I have only 1 File in Queue. - Using Java IO function i calculated length of file and it show 699 MB of Size
File file= new File(“D:/Easy.A.2010.BDRip.XviD-iMBT/easy.a.2010.bdrip.xvid-imbt.avi”);
System.out.println("File Size="+file.length());
// After converting to MBs i got it is 699 MB
at later phase i am splitting file into different equal size parts and uploading to server. as the file size is not actual size of the file so i got Exception
java.lang.NegativeArraySizeException
Please tell me how can i get actual size of the file, or get information about the file that it is complete file or not.
Thanks
I am not sure if this is relevant, but all the torrent clients I have used create files of the final size at the beginning of the download.
i.e for the 699 MB movie, a blank 699 MB file is created right at the start, and the 7 MB downloaded only means that 7 MB from those blanks has been filled in, but the file size on disk remains 699 MB all throughout the download.