public class Files
extends java.lang.Object
| Constructor and Description |
|---|
Files() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
cleanFolder(java.io.File parentFolder,
java.io.FileFilter filter,
boolean continueOnError,
boolean deleteParentFolder)
Clean the content of the given folder.
|
static void |
copyFiles(java.lang.String sourceDir,
java.lang.String targetDir,
java.util.List<java.lang.String> files)
Copies a list of files from a source to a target directory.
|
static java.lang.String |
readFileIntoString(java.lang.String filename)
Deprecated.
Use com.google.common.io.Files.toString(File, Charset) instead
|
static byte[] |
readStreamIntoByteArray(java.io.InputStream inputStream)
Deprecated.
Use com.google.common.io.ByteStreams.toByteArray(InputStream) instead
|
static java.lang.String |
readStreamIntoString(java.io.InputStream inputStream) |
static boolean |
sweepFolder(java.io.File folder)
This will completely sweep the given folder.
|
static void |
writeStringIntoFile(java.lang.String filename,
java.lang.String content) |
public static void copyFiles(java.lang.String sourceDir,
java.lang.String targetDir,
java.util.List<java.lang.String> files)
sourceDir - source directorytargetDir - target directory. Not mandatory to exist before.files - File paths relative to the source directory to copypublic static boolean cleanFolder(java.io.File parentFolder,
java.io.FileFilter filter,
boolean continueOnError,
boolean deleteParentFolder)
throws java.io.FileNotFoundException
parentFolder - the folder to be cleaned. It must not be null.filter - a filter for selecting the files to be removed. If it is null, all the files are removed.continueOnError - indicates if the cleaning should continue after an error occurs.deleteParentFolder - indicates if parentFolder should be also deleted if it becomes empty.true if the cleaning process goes through all the folders and files. false if the process
has been stopped before its termination. The value false could be replied only if the value of
continueOnError is false.java.io.FileNotFoundException - if the given parentFolder does not exists.public static boolean sweepFolder(java.io.File folder)
throws java.io.FileNotFoundException
cleanFolder(File, FileFilter, boolean, boolean) if you want to preserve CVS or SVN information.folder - to deletetrue if all content was successfully deletedjava.io.FileNotFoundException - if folder does not exists@Deprecated public static java.lang.String readFileIntoString(java.lang.String filename)
@Deprecated public static byte[] readStreamIntoByteArray(java.io.InputStream inputStream)
public static java.lang.String readStreamIntoString(java.io.InputStream inputStream)
public static void writeStringIntoFile(java.lang.String filename,
java.lang.String content)