如何使用Java查找剩余的磁盘空间? [英] How to find how much disk space is left using Java?

查看:33
本文介绍了如何使用Java查找剩余的磁盘空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Java查找剩余的磁盘空间?

How to find how much disk space is left using Java?

推荐答案

查看文件类 文档.这是 1.6 的新特性之一.

Have a look at the File class documentation. This is one of the new features in 1.6.

这些新方法还包括:

  • public long getTotalSpace()
  • public long getFreeSpace()
  • public long getUsableSpace()

如果您仍在使用 1.5,那么您可以使用 Apache Commons IO 库及其文件系统类

If you're still using 1.5 then you can use the Apache Commons IO library and its FileSystem class

这篇关于如何使用Java查找剩余的磁盘空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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