下面是一个win下的例子,编译成功之后,运行java diskspace yourdir(比如c:\)
import java.io.inputstreamreader; 【程序编程相关:RCP II:扩展通用工作台(2-1)】import java.io.bufferedreader; 【推荐阅读:关于JSF和Struts的讨论1】
* determine free disk space for a given directory by 【扩展信息:Two Servlet Filters 】/*** parsing the output of the dir command.* this class is inspired by the code at* works only under windows under certain circumstances.* yes, its that shaky.* requires java 1.4 or higher.* @[email protected] *marco schmidt*/public class diskspace{ private diskspace() { // prevent instantiation of this class }/**
* return available free disk space for a directory.* @[email protected]dirname name of the directory* @[email protected]free disk space in bytes or -1 if unknown*/... 下一页