FileStore instead,
Files.getFileStore(Paths.get("/home")).getUsableSpace() or iterate over FileSystems.getDefault().getFileStores()@Deprecated
public class FileSystemUtils
extends java.lang.Object
This class provides static utility methods for general file system functions not provided before Java 6's File class.
The current functions provided are:
| Constructor and Description |
|---|
FileSystemUtils()
Deprecated.
TODO Make private in 3.0.
|
| Modifier and Type | Method and Description |
|---|---|
static long |
freeSpace(java.lang.String path)
Deprecated.
Use freeSpaceKb(String) Deprecated from 1.3, may be removed in 2.0
|
static long |
freeSpaceKb()
Deprecated.
As of 2.6 deprecated without replacement. Please use
FileStore.getUsableSpace(). |
static long |
freeSpaceKb(long timeout)
Deprecated.
As of 2.6 deprecated without replacement. Please use
FileStore.getUsableSpace(). |
static long |
freeSpaceKb(java.lang.String path)
Deprecated.
As of 2.6 deprecated without replacement. Please use
FileStore.getUsableSpace(). |
static long |
freeSpaceKb(java.lang.String path,
long timeout)
Deprecated.
As of 2.6 deprecated without replacement. Please use
FileStore.getUsableSpace(). |
(package private) static long |
getFreeSpace(java.lang.String pathStr)
Deprecated.
Gets the number of bytes available to this Java virtual machine on the given file store.
|
@Deprecated public FileSystemUtils()
@Deprecated
public static long freeSpace(java.lang.String path)
throws java.io.IOException
Note that some OS's are NOT currently supported, including OS/390, OpenVMS.
FileSystemUtils.freeSpace("C:"); // Windows
FileSystemUtils.freeSpace("/volume"); // *nix
path - the path to get free space for, not null, not empty on UNIXjava.io.IOException - if an I/O error occurs.java.lang.IllegalArgumentException - if the path is invalid.@Deprecated
public static long freeSpaceKb()
throws java.io.IOException
FileStore.getUsableSpace().Identical to:
freeSpaceKb(FileUtils.current().getAbsolutePath())
java.io.IOException - if an I/O error occurs.java.lang.IllegalArgumentException - if the path is invalid.@Deprecated
public static long freeSpaceKb(long timeout)
throws java.io.IOException
FileStore.getUsableSpace().Identical to:
freeSpaceKb(FileUtils.current().getAbsolutePath())
timeout - ignored.java.io.IOException - if an I/O error occurs.java.lang.IllegalArgumentException - if the path is invalid.@Deprecated
public static long freeSpaceKb(java.lang.String path)
throws java.io.IOException
FileStore.getUsableSpace().
FileSystemUtils.freeSpaceKb("C:"); // Windows
FileSystemUtils.freeSpaceKb("/volume"); // *nix
path - the path to get free space for, not null, not empty on UNIXjava.io.IOException - if an I/O error occurs.java.lang.IllegalArgumentException - if the path is invalid.@Deprecated
public static long freeSpaceKb(java.lang.String path,
long timeout)
throws java.io.IOException
FileStore.getUsableSpace().
FileSystemUtils.freeSpaceKb("C:"); // Windows
FileSystemUtils.freeSpaceKb("/volume"); // *nix
path - the path to get free space for, not null, not empty on UNIXtimeout - ignored.java.io.IOException - if an I/O error occurs.java.lang.IllegalArgumentException - if the path is invalid.static long getFreeSpace(java.lang.String pathStr)
throws java.io.IOException
FileSystemUtils.freeSpace("C:"); // Windows
FileSystemUtils.freeSpace("/volume"); // *nix
pathStr - the path to get free space for, not null, not empty on UNIXjava.io.IOException - if an I/O error occurs.java.lang.IllegalArgumentException - if the path is invalid.