Class DiskUtils
- java.lang.Object
-
- fr.ens.biologie.genomique.aozan.aozan3.util.DiskUtils
-
public class DiskUtils extends Object
This class contains some system utility methods.- Since:
- 3.0
- Author:
- Laurent Jourdren
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
changeDirectoryMode(Path directory, String mode)
Recursively change the mode of a directory.static void
changeDirectoryOwner(Path directory, String owner)
Recursively change the owner of a directory.static void
changeDirectoryOwner(Path directory, String user, String group)
Recursively change the owner of a directory.static long
du(Path path)
This method returns the disk usage of a directory or a file.
-
-
-
Method Detail
-
du
public static long du(Path path) throws IOException
This method returns the disk usage of a directory or a file.- Parameters:
path
- the path of the directory or the file- Returns:
- the disk usage in bytes
- Throws:
IOException
- if an error occurs while getting the disk usage
-
changeDirectoryOwner
public static void changeDirectoryOwner(Path directory, String owner) throws IOException
Recursively change the owner of a directory.- Parameters:
directory
- the directoryowner
- the new owner of the directory- Throws:
IOException
- if an error occurs while changing the owner of the directory
-
changeDirectoryOwner
public static void changeDirectoryOwner(Path directory, String user, String group) throws IOException
Recursively change the owner of a directory.- Parameters:
directory
- the directoryuser
- the new user of the directorygroup
- the new group of the directory- Throws:
IOException
- if an error occurs while changing the owner of the directory
-
changeDirectoryMode
public static void changeDirectoryMode(Path directory, String mode) throws IOException
Recursively change the mode of a directory.- Parameters:
directory
- the directorymode
- the new mode of the directory and its files and subdirectories- Throws:
IOException
- if an error occurs while changing the owner of the directory
-
-