getFreespace()和File的getUsableSpace之间的区别
我无法指出 getFreeSpace()
和 getUsableSpace()
文件类。当我运行以下代码时,得到相同的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.