, Files.size() IOException, - , File.length() 0. Files.size(), :
File.length(), 0.- ,
File.length(). , IOException Files.size() , .
In addition, as described in this answer , it Files.size()can work with any file system provider (for example, for ZIP or FTP file systems), and it File.length()works only with the "regular" file system open by your operating system.
Conclusion In general, prefer methods from a newer class Filesover an old class File.
source
share