Java Maximum File Size

删除回忆录丶 提交于 2019-12-23 12:33:20

问题


Is there an cross-platform way to determine the maximum file size of the host OS in Java?


回答1:


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).




回答2:


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.



来源:https://stackoverflow.com/questions/2905974/java-maximum-file-size

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!