Reputation: 22461
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.
Is 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. :)
Upvotes: 3
Views: 1836
Reputation: 22721
I believe that File.length()
returns a long
? That should be sufficient.
Upvotes: 3
Reputation: 13946
According to the File
API doc, length()
returns long
, not int
.
Upvotes: 3