FileSystemUtils.html 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <!-- NewPage -->
  3. <html lang="de">
  4. <head>
  5. <!-- Generated by javadoc -->
  6. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  7. <title>FileSystemUtils (Apache Commons IO 2.6 API)</title>
  8. <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
  9. <script type="text/javascript" src="../../../../script.js"></script>
  10. </head>
  11. <body>
  12. <script type="text/javascript"><!--
  13. try {
  14. if (location.href.indexOf('is-external=true') == -1) {
  15. parent.document.title="FileSystemUtils (Apache Commons IO 2.6 API)";
  16. }
  17. }
  18. catch(err) {
  19. }
  20. //-->
  21. var methods = {"i0":41,"i1":41,"i2":41,"i3":41,"i4":41};
  22. var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"],32:["t6","Deprecated Methods"]};
  23. var altColor = "altColor";
  24. var rowColor = "rowColor";
  25. var tableTab = "tableTab";
  26. var activeTableTab = "activeTableTab";
  27. </script>
  28. <noscript>
  29. <div>JavaScript is disabled on your browser.</div>
  30. </noscript>
  31. <!-- ========= START OF TOP NAVBAR ======= -->
  32. <div class="topNav"><a name="navbar.top">
  33. <!-- -->
  34. </a>
  35. <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
  36. <a name="navbar.top.firstrow">
  37. <!-- -->
  38. </a>
  39. <ul class="navList" title="Navigation">
  40. <li><a href="../../../../overview-summary.html">Overview</a></li>
  41. <li><a href="package-summary.html">Package</a></li>
  42. <li class="navBarCell1Rev">Class</li>
  43. <li><a href="class-use/FileSystemUtils.html">Use</a></li>
  44. <li><a href="package-tree.html">Tree</a></li>
  45. <li><a href="../../../../deprecated-list.html">Deprecated</a></li>
  46. <li><a href="../../../../index-all.html">Index</a></li>
  47. <li><a href="../../../../help-doc.html">Help</a></li>
  48. </ul>
  49. </div>
  50. <div class="subNav">
  51. <ul class="navList">
  52. <li><a href="../../../../org/apache/commons/io/FilenameUtils.html" title="class in org.apache.commons.io"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
  53. <li><a href="../../../../org/apache/commons/io/FileUtils.html" title="class in org.apache.commons.io"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
  54. </ul>
  55. <ul class="navList">
  56. <li><a href="../../../../index.html?org/apache/commons/io/FileSystemUtils.html" target="_top">Frames</a></li>
  57. <li><a href="FileSystemUtils.html" target="_top">No&nbsp;Frames</a></li>
  58. </ul>
  59. <ul class="navList" id="allclasses_navbar_top">
  60. <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
  61. </ul>
  62. <div>
  63. <script type="text/javascript"><!--
  64. allClassesLink = document.getElementById("allclasses_navbar_top");
  65. if(window==top) {
  66. allClassesLink.style.display = "block";
  67. }
  68. else {
  69. allClassesLink.style.display = "none";
  70. }
  71. //-->
  72. </script>
  73. </div>
  74. <div>
  75. <ul class="subNavList">
  76. <li>Summary:&nbsp;</li>
  77. <li>Nested&nbsp;|&nbsp;</li>
  78. <li>Field&nbsp;|&nbsp;</li>
  79. <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
  80. <li><a href="#method.summary">Method</a></li>
  81. </ul>
  82. <ul class="subNavList">
  83. <li>Detail:&nbsp;</li>
  84. <li>Field&nbsp;|&nbsp;</li>
  85. <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
  86. <li><a href="#method.detail">Method</a></li>
  87. </ul>
  88. </div>
  89. <a name="skip.navbar.top">
  90. <!-- -->
  91. </a></div>
  92. <!-- ========= END OF TOP NAVBAR ========= -->
  93. <!-- ======== START OF CLASS DATA ======== -->
  94. <div class="header">
  95. <div class="subTitle">org.apache.commons.io</div>
  96. <h2 title="Class FileSystemUtils" class="title">Class FileSystemUtils</h2>
  97. </div>
  98. <div class="contentContainer">
  99. <ul class="inheritance">
  100. <li><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
  101. <li>
  102. <ul class="inheritance">
  103. <li>org.apache.commons.io.FileSystemUtils</li>
  104. </ul>
  105. </li>
  106. </ul>
  107. <div class="description">
  108. <ul class="blockList">
  109. <li class="blockList">
  110. <hr>
  111. <div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
  112. <div class="block"><span class="deprecationComment">As of 2.6 deprecated without replacement. Use equivalent
  113. methods in <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileStore.html?is-external=true" title="class or interface in java.nio.file"><code>FileStore</code></a> instead, e.g.
  114. <code>Files.getFileStore(Paths.get("/home")).getUsableSpace()</code>
  115. or iterate over <code>FileSystems.getDefault().getFileStores()</code></span></div>
  116. </div>
  117. <br>
  118. <pre><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
  119. public class <span class="typeNameLabel">FileSystemUtils</span>
  120. extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
  121. <div class="block">General File System utilities.
  122. <p>
  123. This class provides static utility methods for general file system
  124. functions not provided via the JDK <a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io"><code>File</code></a> class.
  125. <p>
  126. The current functions provided are:
  127. <ul>
  128. <li>Get the free space on a drive
  129. </ul></div>
  130. <dl>
  131. <dt><span class="simpleTagLabel">Since:</span></dt>
  132. <dd>1.1</dd>
  133. </dl>
  134. </li>
  135. </ul>
  136. </div>
  137. <div class="summary">
  138. <ul class="blockList">
  139. <li class="blockList">
  140. <!-- ======== CONSTRUCTOR SUMMARY ======== -->
  141. <ul class="blockList">
  142. <li class="blockList"><a name="constructor.summary">
  143. <!-- -->
  144. </a>
  145. <h3>Constructor Summary</h3>
  146. <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
  147. <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
  148. <tr>
  149. <th class="colOne" scope="col">Constructor and Description</th>
  150. </tr>
  151. <tr class="altColor">
  152. <td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileSystemUtils.html#FileSystemUtils--">FileSystemUtils</a></span>()</code>
  153. <div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;</div>
  154. <div class="block">Instances should NOT be constructed in standard programming.</div>
  155. </td>
  156. </tr>
  157. </table>
  158. </li>
  159. </ul>
  160. <!-- ========== METHOD SUMMARY =========== -->
  161. <ul class="blockList">
  162. <li class="blockList"><a name="method.summary">
  163. <!-- -->
  164. </a>
  165. <h3>Method Summary</h3>
  166. <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
  167. <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t6" class="tableTab"><span><a href="javascript:show(32);">Deprecated Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
  168. <tr>
  169. <th class="colFirst" scope="col">Modifier and Type</th>
  170. <th class="colLast" scope="col">Method and Description</th>
  171. </tr>
  172. <tr id="i0" class="altColor">
  173. <td class="colFirst"><code>static long</code></td>
  174. <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileSystemUtils.html#freeSpace-java.lang.String-">freeSpace</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;path)</code>
  175. <div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
  176. <div class="block"><span class="deprecationComment">Use freeSpaceKb(String)
  177. Deprecated from 1.3, may be removed in 2.0</span></div>
  178. </div>
  179. </td>
  180. </tr>
  181. <tr id="i1" class="rowColor">
  182. <td class="colFirst"><code>static long</code></td>
  183. <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileSystemUtils.html#freeSpaceKb--">freeSpaceKb</a></span>()</code>
  184. <div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
  185. <div class="block"><span class="deprecationComment">As of 2.6 deprecated without replacement. Please use <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileStore.html?is-external=true#getUsableSpace--" title="class or interface in java.nio.file"><code>FileStore.getUsableSpace()</code></a>.</span></div>
  186. </div>
  187. </td>
  188. </tr>
  189. <tr id="i2" class="altColor">
  190. <td class="colFirst"><code>static long</code></td>
  191. <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileSystemUtils.html#freeSpaceKb-long-">freeSpaceKb</a></span>(long&nbsp;timeout)</code>
  192. <div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
  193. <div class="block"><span class="deprecationComment">As of 2.6 deprecated without replacement. Please use <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileStore.html?is-external=true#getUsableSpace--" title="class or interface in java.nio.file"><code>FileStore.getUsableSpace()</code></a>.</span></div>
  194. </div>
  195. </td>
  196. </tr>
  197. <tr id="i3" class="rowColor">
  198. <td class="colFirst"><code>static long</code></td>
  199. <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileSystemUtils.html#freeSpaceKb-java.lang.String-">freeSpaceKb</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;path)</code>
  200. <div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
  201. <div class="block"><span class="deprecationComment">As of 2.6 deprecated without replacement. Please use <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileStore.html?is-external=true#getUsableSpace--" title="class or interface in java.nio.file"><code>FileStore.getUsableSpace()</code></a>.</span></div>
  202. </div>
  203. </td>
  204. </tr>
  205. <tr id="i4" class="altColor">
  206. <td class="colFirst"><code>static long</code></td>
  207. <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/commons/io/FileSystemUtils.html#freeSpaceKb-java.lang.String-long-">freeSpaceKb</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;path,
  208. long&nbsp;timeout)</code>
  209. <div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
  210. <div class="block"><span class="deprecationComment">As of 2.6 deprecated without replacement. Please use <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileStore.html?is-external=true#getUsableSpace--" title="class or interface in java.nio.file"><code>FileStore.getUsableSpace()</code></a>.</span></div>
  211. </div>
  212. </td>
  213. </tr>
  214. </table>
  215. <ul class="blockList">
  216. <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
  217. <!-- -->
  218. </a>
  219. <h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
  220. <code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
  221. </ul>
  222. </li>
  223. </ul>
  224. </li>
  225. </ul>
  226. </div>
  227. <div class="details">
  228. <ul class="blockList">
  229. <li class="blockList">
  230. <!-- ========= CONSTRUCTOR DETAIL ======== -->
  231. <ul class="blockList">
  232. <li class="blockList"><a name="constructor.detail">
  233. <!-- -->
  234. </a>
  235. <h3>Constructor Detail</h3>
  236. <a name="FileSystemUtils--">
  237. <!-- -->
  238. </a>
  239. <ul class="blockListLast">
  240. <li class="blockList">
  241. <h4>FileSystemUtils</h4>
  242. <pre>public&nbsp;FileSystemUtils()</pre>
  243. <div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;</div>
  244. <div class="block">Instances should NOT be constructed in standard programming.</div>
  245. </li>
  246. </ul>
  247. </li>
  248. </ul>
  249. <!-- ============ METHOD DETAIL ========== -->
  250. <ul class="blockList">
  251. <li class="blockList"><a name="method.detail">
  252. <!-- -->
  253. </a>
  254. <h3>Method Detail</h3>
  255. <a name="freeSpace-java.lang.String-">
  256. <!-- -->
  257. </a>
  258. <ul class="blockList">
  259. <li class="blockList">
  260. <h4>freeSpace</h4>
  261. <pre><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
  262. public static&nbsp;long&nbsp;freeSpace(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;path)
  263. throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
  264. <div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">Use freeSpaceKb(String)
  265. Deprecated from 1.3, may be removed in 2.0</span></div>
  266. <div class="block">Returns the free space on a drive or volume by invoking
  267. the command line.
  268. This method does not normalize the result, and typically returns
  269. bytes on Windows, 512 byte units on OS X and kilobytes on Unix.
  270. As this is not very useful, this method is deprecated in favour
  271. of <a href="../../../../org/apache/commons/io/FileSystemUtils.html#freeSpaceKb-java.lang.String-"><code>freeSpaceKb(String)</code></a> which returns a result in kilobytes.
  272. <p>
  273. Note that some OS's are NOT currently supported, including OS/390,
  274. OpenVMS.
  275. <pre>
  276. FileSystemUtils.freeSpace("C:"); // Windows
  277. FileSystemUtils.freeSpace("/volume"); // *nix
  278. </pre>
  279. The free space is calculated via the command line.
  280. It uses 'dir /-c' on Windows and 'df' on *nix.</div>
  281. <dl>
  282. <dt><span class="paramLabel">Parameters:</span></dt>
  283. <dd><code>path</code> - the path to get free space for, not null, not empty on Unix</dd>
  284. <dt><span class="returnLabel">Returns:</span></dt>
  285. <dd>the amount of free drive space on the drive or volume</dd>
  286. <dt><span class="throwsLabel">Throws:</span></dt>
  287. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the path is invalid</dd>
  288. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</a></code> - if an error occurred in initialisation</dd>
  289. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - if an error occurs when finding the free space</dd>
  290. <dt><span class="simpleTagLabel">Since:</span></dt>
  291. <dd>1.1, enhanced OS support in 1.2 and 1.3</dd>
  292. </dl>
  293. </li>
  294. </ul>
  295. <a name="freeSpaceKb-java.lang.String-">
  296. <!-- -->
  297. </a>
  298. <ul class="blockList">
  299. <li class="blockList">
  300. <h4>freeSpaceKb</h4>
  301. <pre><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
  302. public static&nbsp;long&nbsp;freeSpaceKb(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;path)
  303. throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
  304. <div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">As of 2.6 deprecated without replacement. Please use <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileStore.html?is-external=true#getUsableSpace--" title="class or interface in java.nio.file"><code>FileStore.getUsableSpace()</code></a>.</span></div>
  305. <div class="block">Returns the free space on a drive or volume in kibibytes (1024 bytes)
  306. by invoking the command line.
  307. <pre>
  308. FileSystemUtils.freeSpaceKb("C:"); // Windows
  309. FileSystemUtils.freeSpaceKb("/volume"); // *nix
  310. </pre>
  311. The free space is calculated via the command line.
  312. It uses 'dir /-c' on Windows, 'df -kP' on AIX/HP-UX and 'df -k' on other Unix.
  313. <p>
  314. In order to work, you must be running Windows, or have a implementation of
  315. Unix df that supports GNU format when passed -k (or -kP). If you are going
  316. to rely on this code, please check that it works on your OS by running
  317. some simple tests to compare the command line with the output from this class.
  318. If your operating system isn't supported, please raise a JIRA call detailing
  319. the exact result from df -k and as much other detail as possible, thanks.</div>
  320. <dl>
  321. <dt><span class="paramLabel">Parameters:</span></dt>
  322. <dd><code>path</code> - the path to get free space for, not null, not empty on Unix</dd>
  323. <dt><span class="returnLabel">Returns:</span></dt>
  324. <dd>the amount of free drive space on the drive or volume in kilobytes</dd>
  325. <dt><span class="throwsLabel">Throws:</span></dt>
  326. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the path is invalid</dd>
  327. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</a></code> - if an error occurred in initialisation</dd>
  328. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - if an error occurs when finding the free space</dd>
  329. <dt><span class="simpleTagLabel">Since:</span></dt>
  330. <dd>1.2, enhanced OS support in 1.3</dd>
  331. </dl>
  332. </li>
  333. </ul>
  334. <a name="freeSpaceKb-java.lang.String-long-">
  335. <!-- -->
  336. </a>
  337. <ul class="blockList">
  338. <li class="blockList">
  339. <h4>freeSpaceKb</h4>
  340. <pre><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
  341. public static&nbsp;long&nbsp;freeSpaceKb(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;path,
  342. long&nbsp;timeout)
  343. throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
  344. <div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">As of 2.6 deprecated without replacement. Please use <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileStore.html?is-external=true#getUsableSpace--" title="class or interface in java.nio.file"><code>FileStore.getUsableSpace()</code></a>.</span></div>
  345. <div class="block">Returns the free space on a drive or volume in kibibytes (1024 bytes)
  346. by invoking the command line.
  347. <pre>
  348. FileSystemUtils.freeSpaceKb("C:"); // Windows
  349. FileSystemUtils.freeSpaceKb("/volume"); // *nix
  350. </pre>
  351. The free space is calculated via the command line.
  352. It uses 'dir /-c' on Windows, 'df -kP' on AIX/HP-UX and 'df -k' on other Unix.
  353. <p>
  354. In order to work, you must be running Windows, or have a implementation of
  355. Unix df that supports GNU format when passed -k (or -kP). If you are going
  356. to rely on this code, please check that it works on your OS by running
  357. some simple tests to compare the command line with the output from this class.
  358. If your operating system isn't supported, please raise a JIRA call detailing
  359. the exact result from df -k and as much other detail as possible, thanks.</div>
  360. <dl>
  361. <dt><span class="paramLabel">Parameters:</span></dt>
  362. <dd><code>path</code> - the path to get free space for, not null, not empty on Unix</dd>
  363. <dd><code>timeout</code> - The timeout amount in milliseconds or no timeout if the value
  364. is zero or less</dd>
  365. <dt><span class="returnLabel">Returns:</span></dt>
  366. <dd>the amount of free drive space on the drive or volume in kilobytes</dd>
  367. <dt><span class="throwsLabel">Throws:</span></dt>
  368. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the path is invalid</dd>
  369. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</a></code> - if an error occurred in initialisation</dd>
  370. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - if an error occurs when finding the free space</dd>
  371. <dt><span class="simpleTagLabel">Since:</span></dt>
  372. <dd>2.0</dd>
  373. </dl>
  374. </li>
  375. </ul>
  376. <a name="freeSpaceKb--">
  377. <!-- -->
  378. </a>
  379. <ul class="blockList">
  380. <li class="blockList">
  381. <h4>freeSpaceKb</h4>
  382. <pre><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
  383. public static&nbsp;long&nbsp;freeSpaceKb()
  384. throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
  385. <div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">As of 2.6 deprecated without replacement. Please use <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileStore.html?is-external=true#getUsableSpace--" title="class or interface in java.nio.file"><code>FileStore.getUsableSpace()</code></a>.</span></div>
  386. <div class="block">Returns the free space for the working directory
  387. in kibibytes (1024 bytes) by invoking the command line.
  388. <p>
  389. Identical to:
  390. <pre>
  391. freeSpaceKb(new File(".").getAbsolutePath())
  392. </pre></div>
  393. <dl>
  394. <dt><span class="returnLabel">Returns:</span></dt>
  395. <dd>the amount of free drive space on the drive or volume in kilobytes</dd>
  396. <dt><span class="throwsLabel">Throws:</span></dt>
  397. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</a></code> - if an error occurred in initialisation</dd>
  398. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - if an error occurs when finding the free space</dd>
  399. <dt><span class="simpleTagLabel">Since:</span></dt>
  400. <dd>2.0</dd>
  401. </dl>
  402. </li>
  403. </ul>
  404. <a name="freeSpaceKb-long-">
  405. <!-- -->
  406. </a>
  407. <ul class="blockListLast">
  408. <li class="blockList">
  409. <h4>freeSpaceKb</h4>
  410. <pre><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
  411. public static&nbsp;long&nbsp;freeSpaceKb(long&nbsp;timeout)
  412. throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
  413. <div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">As of 2.6 deprecated without replacement. Please use <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileStore.html?is-external=true#getUsableSpace--" title="class or interface in java.nio.file"><code>FileStore.getUsableSpace()</code></a>.</span></div>
  414. <div class="block">Returns the free space for the working directory
  415. in kibibytes (1024 bytes) by invoking the command line.
  416. <p>
  417. Identical to:
  418. <pre>
  419. freeSpaceKb(new File(".").getAbsolutePath())
  420. </pre></div>
  421. <dl>
  422. <dt><span class="paramLabel">Parameters:</span></dt>
  423. <dd><code>timeout</code> - The timeout amount in milliseconds or no timeout if the value
  424. is zero or less</dd>
  425. <dt><span class="returnLabel">Returns:</span></dt>
  426. <dd>the amount of free drive space on the drive or volume in kilobytes</dd>
  427. <dt><span class="throwsLabel">Throws:</span></dt>
  428. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</a></code> - if an error occurred in initialisation</dd>
  429. <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - if an error occurs when finding the free space</dd>
  430. <dt><span class="simpleTagLabel">Since:</span></dt>
  431. <dd>2.0</dd>
  432. </dl>
  433. </li>
  434. </ul>
  435. </li>
  436. </ul>
  437. </li>
  438. </ul>
  439. </div>
  440. </div>
  441. <!-- ========= END OF CLASS DATA ========= -->
  442. <!-- ======= START OF BOTTOM NAVBAR ====== -->
  443. <div class="bottomNav"><a name="navbar.bottom">
  444. <!-- -->
  445. </a>
  446. <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
  447. <a name="navbar.bottom.firstrow">
  448. <!-- -->
  449. </a>
  450. <ul class="navList" title="Navigation">
  451. <li><a href="../../../../overview-summary.html">Overview</a></li>
  452. <li><a href="package-summary.html">Package</a></li>
  453. <li class="navBarCell1Rev">Class</li>
  454. <li><a href="class-use/FileSystemUtils.html">Use</a></li>
  455. <li><a href="package-tree.html">Tree</a></li>
  456. <li><a href="../../../../deprecated-list.html">Deprecated</a></li>
  457. <li><a href="../../../../index-all.html">Index</a></li>
  458. <li><a href="../../../../help-doc.html">Help</a></li>
  459. </ul>
  460. </div>
  461. <div class="subNav">
  462. <ul class="navList">
  463. <li><a href="../../../../org/apache/commons/io/FilenameUtils.html" title="class in org.apache.commons.io"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
  464. <li><a href="../../../../org/apache/commons/io/FileUtils.html" title="class in org.apache.commons.io"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
  465. </ul>
  466. <ul class="navList">
  467. <li><a href="../../../../index.html?org/apache/commons/io/FileSystemUtils.html" target="_top">Frames</a></li>
  468. <li><a href="FileSystemUtils.html" target="_top">No&nbsp;Frames</a></li>
  469. </ul>
  470. <ul class="navList" id="allclasses_navbar_bottom">
  471. <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
  472. </ul>
  473. <div>
  474. <script type="text/javascript"><!--
  475. allClassesLink = document.getElementById("allclasses_navbar_bottom");
  476. if(window==top) {
  477. allClassesLink.style.display = "block";
  478. }
  479. else {
  480. allClassesLink.style.display = "none";
  481. }
  482. //-->
  483. </script>
  484. </div>
  485. <div>
  486. <ul class="subNavList">
  487. <li>Summary:&nbsp;</li>
  488. <li>Nested&nbsp;|&nbsp;</li>
  489. <li>Field&nbsp;|&nbsp;</li>
  490. <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
  491. <li><a href="#method.summary">Method</a></li>
  492. </ul>
  493. <ul class="subNavList">
  494. <li>Detail:&nbsp;</li>
  495. <li>Field&nbsp;|&nbsp;</li>
  496. <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
  497. <li><a href="#method.detail">Method</a></li>
  498. </ul>
  499. </div>
  500. <a name="skip.navbar.bottom">
  501. <!-- -->
  502. </a></div>
  503. <!-- ======== END OF BOTTOM NAVBAR ======= -->
  504. <p class="legalCopy"><small>Copyright &#169; 2002&#x2013;2017 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
  505. </body>
  506. </html>