public class FileUtils extends Object
Constructor and Description |
---|
FileUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
copyFile(org.osgi.framework.Bundle bundle,
org.eclipse.core.runtime.IPath file,
String savePath,
boolean overWrite)
Copy file in bundle to specified path
|
static void |
copyFile(FileInputStream source,
FileOutputStream dest)
copy a file
|
static boolean |
copyFile(File source,
String dest,
boolean overWrite)
copy a file
|
static boolean |
copyFile(String source,
String dest,
boolean overWrite)
copy a file
|
static void |
copyFiles(File baseDir,
File newParent,
String pattern)
Copy files matching a certain pattern from one directory to another
|
static void |
deleteFiles(File rootDir)
delete files or directories under the specified root directory
|
static void |
deleteFiles(File baseDir,
String pattern)
delete files or directories matching a specified pattern
|
static void |
findFiles(FilenameFilter filter,
File baseDir,
List<File> fileList)
Find files matching a specified pattern in a specified location
|
static File[] |
findFiles(String fileDesc,
File baseDir)
Find files matching a specified pattern in a specified location
|
static String |
getActfTempDir()
Create the ACTF temporary directory which is a subdirectory of the value of java.io.tmpdir
Checking is done to ensure a File.separator is added if needed.
|
static boolean |
isAvailableDirectory(String path)
Confirm availability of the directory
|
static String |
replaceWhiteSpaceInUrl(String target)
Replace white space " " in URL string with "%20"
|
static boolean |
saveToFile(InputStream is,
String savePath,
boolean overWrite)
Save target input stream to specified path
|
public static final String LINE_SEP
public static String replaceWhiteSpaceInUrl(String target)
target
- the target URL Stringpublic static boolean copyFile(File source, String dest, boolean overWrite)
source
- -
the source Filedest
- -
the destination file path in StringoverWrite
- -
allow to overwrite the existing file or notpublic static boolean copyFile(String source, String dest, boolean overWrite)
source
- -
the source file path in Stringdest
- -
the destination file path in StringoverWrite
- -
allow to overwrite the existing file or notpublic static void copyFile(FileInputStream source, FileOutputStream dest) throws IOException
source
- -
the source file input streamdest
- -
the destination file output streamIOException
public static void copyFiles(File baseDir, File newParent, String pattern)
baseDir
- -
the directory to copy from - must be existingnewParent
- -
the directory to copy to - must be existingpattern
- -
the pattern of files to copypublic static boolean copyFile(org.osgi.framework.Bundle bundle, org.eclipse.core.runtime.IPath file, String savePath, boolean overWrite)
bundle
- the target bundlefile
- the target file pathsavePath
- the target path to copy the fileoverWrite
- allow to overwrite the existing file or notpublic static boolean saveToFile(InputStream is, String savePath, boolean overWrite)
is
- the target input streamsavePath
- the target path to store the fileoverWrite
- allow to overwrite the existing file or notpublic static void deleteFiles(File rootDir)
rootDir
- -
root directory from which to start - must be existing
directorypublic static void deleteFiles(File baseDir, String pattern)
baseDir
- -
root directory from which to start - must be existing
directorypattern
- -
the pattern of file names to erasepublic static File[] findFiles(String fileDesc, File baseDir)
fileDesc
- -
the filename pattern you are searching forbaseDir
- -
the directory to search - must be existingpublic static void findFiles(FilenameFilter filter, File baseDir, List<File> fileList)
filter
- -
filename filter of matching patternbaseDir
- -
the directory from which to start the searchfileList
- -
a Linked List where the found files will be returnedpublic static boolean isAvailableDirectory(String path)
path
- target directory pathpublic static String getActfTempDir()