如何找到使用Java留下多少磁盘空间? [英] How to find how much disk space is left using Java?

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

问题描述

如何找到使用Java剩余多少磁盘空间?

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

推荐答案

只需查看File类文档。这是1.6中的新功能之一。

Just 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()

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

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

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

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

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