开发者

Getting the size of a big file

开发者 https://www.devze.com 2023-03-09 04:36 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消