public class BootstrapFileUtils
extends java.lang.Object
Constructor and Description |
---|
BootstrapFileUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
cleanDirectory(java.io.File directory)
Cleans a directory without deleting it.
|
static void |
copyAll(java.io.File sourceFolder,
java.io.File destFolder)
Copies all of the files (shallow) in the source folder into the destination folder
|
static void |
copyFile(java.io.File source,
java.io.File dest)
Copies the source file to the destination file, creating the destination if necessary.
|
static void |
copyFile(java.io.InputStream fin,
java.io.File dest)
Copies all remaining bytes in the input stream to the output file, creating the destination file if necessary.
|
static void |
deleteDirectory(java.io.File directory)
Deletes a directory recursively.
|
static void |
forceDelete(java.io.File file)
Deletes a file.
|
static java.io.File |
getSubDir(java.io.File base,
java.lang.String... subDirs)
Returns a File representing a subdirectory, by following the paths from the base folder.
|
public static void copyAll(java.io.File sourceFolder, java.io.File destFolder) throws java.io.IOException
java.io.IOException
public static void copyFile(java.io.File source, java.io.File dest) throws java.io.IOException
java.io.IOException
public static void copyFile(java.io.InputStream fin, java.io.File dest) throws java.io.IOException
fin
- input stream to copydest
- where to create/overwrite the copy, creating file.java.io.IOException
- when i/o error occurspublic static java.io.File getSubDir(java.io.File base, java.lang.String... subDirs)
base
- A File that represents the starting folders.subDirs
- Names of folders to follow from the base.public static void cleanDirectory(java.io.File directory) throws java.io.IOException
directory
- directory to cleanjava.io.IOException
- in case cleaning is unsuccessfulpublic static void forceDelete(java.io.File file) throws java.io.IOException
The difference between File.delete() and this method are:
file
- file or directory to delete, must not be null
java.lang.NullPointerException
- if the directory is null
java.io.FileNotFoundException
- if the file was not foundjava.io.IOException
- in case deletion is unsuccessfulpublic static void deleteDirectory(java.io.File directory) throws java.io.IOException
directory
- directory to deletejava.io.IOException
- in case deletion is unsuccessful