getFreespace()和File的getUsableSpace之间的区别 [英] Difference between getFreespace() and getUsableSpace of File

查看:4544
本文介绍了getFreespace()和File的getUsableSpace之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法指出 getFreeSpace() getUsableSpace() <$ c $的方法之间的确切差异c>文件类。当我运行以下代码时,得到相同的o / p。

I could not point out exact difference between getFreeSpace() and getUsableSpace() method of File class. When i run following code , got same o/p.

Class Start {
    public static void main(String [] args) {
        File myfile = new File("C:\\html\abc.txt");
        myfile.createNewFile();
        Systyem.out.println("free space"+myfile.getFreeSpace()+"usable space"+myfile.getUsableSpace());")
    }
}

O / P是


免费空间445074731008可用空间445074731008

free space445074731008 usable space445074731008

任何人都可以告诉我究竟有什么区别吗?

Could any one tell me what is exact difference ?

推荐答案

java.io.File.getFreeSpace()方法返回此抽象路径指定的分区中未分配的字节数返回的未分配字节数不是保证。未分配的字节数可能在此调用后立即准确,并且不受任何外部I / O操作的影响。

The java.io.File.getFreeSpace() method returns the number of unallocated bytes in the partition named by this abstract path name. The returned number of unallocated bytes are not a gurantee. The count of unallocated bytes is likely to be accurate immediately after this call and inaccurate by any external I/O operations.

java.io.File.getUsableSpace()方法返回此抽象名称所指定的分区上此虚拟机可用的字节数。此方法通常提供更准确地估计实际可以获得多少新数据写入,因为此方法检查写入权限和其他操作系统限制。

The java.io.File.getUsableSpace() method returns the number of bytes available to this virtual machine on the partitioned named by this abstract name. This method usually provide a more accurate estimate of how much new data can actually be written as this method checks for write permissions and other operating system restrictions.

这篇关于getFreespace()和File的getUsableSpace之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆