Difference between getFreespace() and getUsableSpace of File

后端 未结 3 968
慢半拍i
慢半拍i 2021-01-03 23:53

I could not point out exact difference between getFreeSpace() and getUsableSpace() method of File class. When i run following code

3条回答
  •  感情败类
    2021-01-04 00:47

    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.

    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.

提交回复
热议问题