Is there an cross-platform way to determine the maximum file size of the ho开发者_运维百科st OS in Java?
No, maximum file size is file system dependent. (you can see a comparison here). You can figure out the file system type using a platform specific manner (for example, mount on linux).
The largest file is surely no larger than the amount of free space, which you can get via
long FileSystemUtils.freeSpaceKb(String path)
from Apache Commons IO
On JDK 6, you can use File.getFreeSpace() to find the free space of the partition containing the file.
精彩评论