Getting the size of a big file
Pretty basic stuff but I can't find a way to read the size of a file with several gigabytes.
I'm aware of the method File.length
.
But int max value is 2,147,483,647.
I开发者_开发知识库s there a standard API method to read the size of a file with more than 2 gigabytes (maybe something that returns the length in kilobytes, or with Long / BigInteger)? If there isn't, which libraries are used to do that?
Update
People kindly pointed out that I should RTFM. Long max size can fit 8388608 terabytes. :)
Cheers,
File.length()
returns a long
According to the File
API doc, length()
returns long
, not int
.
I believe that File.length()
returns a long
? That should be sufficient.
精彩评论