Package org.xipki.util
Class FileUtils
- java.lang.Object
-
- org.xipki.util.FileUtils
-
public class FileUtils extends Object
File utility class.- Since:
- 2.2.0
- Author:
- Lijun Liao (xipki)
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcopyDirectory(File srcDir, File destDir)static voidcopyFile(File srcFile, File destFile, boolean preserveFileDate)Copied from the apache commons io projectstatic voiddeleteDirectory(File directory)Copied from the apache commons io project.
-
-
-
Method Detail
-
deleteDirectory
public static void deleteDirectory(File directory) throws IOException
Copied from the apache commons io project.Deletes a directory recursively.
- Parameters:
directory- - directory to delete- Throws:
IOException- in case deletion is unsuccessfulIllegalArgumentException- ifdirectorydoes not exist or is not a directory
-
copyFile
public static void copyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException
Copied from the apache commons io projectInternal copy file method. This caches the original file length, and an IOException will be thrown if the output file length is different from the current input file length. So it may fail if the file changes size. It may also fail with "IllegalArgumentException: Negative size" if the input file is truncated part way through copying the data and the new file size is less than the current position.
- Parameters:
srcFile- - the validated source file, may not benulldestFile- - the validated destination file, may not benullpreserveFileDate- whether to preserve the file date- Throws:
IOException- if an error occursIOException- if the output file length is not the same as the input file length after the copy completesIllegalArgumentException- "Negative size" if the file is truncated so that the size is less than the position
-
copyDirectory
public static void copyDirectory(File srcDir, File destDir) throws IOException
- Throws:
IOException
-
-