Skip to content

Commit 1282c29

Browse files
committed
IO-194 FreeSpaceKb() with no input arguments
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/io/trunk@919691 13f79535-47bb-0310-9956-ffa450edef68
1 parent d577693 commit 1282c29

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/java/org/apache/commons/io/FileSystemUtils.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.apache.commons.io;
1818

1919
import java.io.BufferedReader;
20+
import java.io.File;
2021
import java.io.IOException;
2122
import java.io.InputStream;
2223
import java.io.InputStreamReader;
@@ -176,6 +177,21 @@ public static long freeSpaceKb(String path) throws IOException {
176177
return INSTANCE.freeSpaceOS(path, OS, true);
177178
}
178179

180+
/**
181+
* Returns the disk size of the volume which holds the working directory.
182+
* <p>
183+
* Identical to:
184+
* <pre>
185+
* freeSpaceKb(new File(".").getAbsolutePath())
186+
* </pre>
187+
* @return the amount of free drive space on the drive or volume in kilobytes
188+
* @throws IllegalStateException if an error occurred in initialisation
189+
* @throws IOException if an error occurs when finding the free space
190+
*/
191+
public static long freeSpaceKb() throws IOException {
192+
return freeSpaceKb(new File(".").getAbsolutePath());
193+
}
194+
179195
//-----------------------------------------------------------------------
180196
/**
181197
* Returns the free space on a drive or volume in a cross-platform manner.

0 commit comments

Comments
 (0)