public class FileUtils
extends org.apache.commons.io.FileUtils
FileUtils contains useful methods for dealing with files & directories. This is based on the mule core class so we
can have control over it| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_ENCODING |
| Constructor and Description |
|---|
FileUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
extractResources(String resourceName,
Class callingClass,
File outputDir,
boolean keepParentDirectory)
Extract the specified resource to the given directory for remain all directory struct
|
static File |
findFileByName(File folder,
String filename,
boolean recursive)
Looks for a file inside a given folder
|
static String |
generateRandomFileName(String prefix,
String suffix)
Generates a file name appending a random number between the given prefix and suffix
|
static String |
normalizeFilePath(URL url,
String encoding)
Remove from uri to file prefix file:/ Add if need file separator to begin
|
byteCountToDisplaySize, byteCountToDisplaySize, checksum, checksumCRC32, cleanDirectory, contentEquals, contentEqualsIgnoreEOL, convertFileCollectionToFileArray, copyDirectory, copyDirectory, copyDirectory, copyDirectory, copyDirectoryToDirectory, copyFile, copyFile, copyFile, copyFileToDirectory, copyFileToDirectory, copyInputStreamToFile, copyToFile, copyURLToFile, copyURLToFile, deleteDirectory, deleteQuietly, directoryContains, forceDelete, forceDeleteOnExit, forceMkdir, forceMkdirParent, getFile, getFile, getTempDirectory, getTempDirectoryPath, getUserDirectory, getUserDirectoryPath, isFileNewer, isFileNewer, isFileNewer, isFileOlder, isFileOlder, isFileOlder, isSymlink, iterateFiles, iterateFiles, iterateFilesAndDirs, lineIterator, lineIterator, listFiles, listFiles, listFilesAndDirs, moveDirectory, moveDirectoryToDirectory, moveFile, moveFileToDirectory, moveToDirectory, openInputStream, openOutputStream, openOutputStream, readFileToByteArray, readFileToString, readFileToString, readFileToString, readLines, readLines, readLines, sizeOf, sizeOfAsBigInteger, sizeOfDirectory, sizeOfDirectoryAsBigInteger, toFile, toFiles, touch, toURLs, waitFor, write, write, write, write, write, write, writeByteArrayToFile, writeByteArrayToFile, writeByteArrayToFile, writeByteArrayToFile, writeLines, writeLines, writeLines, writeLines, writeLines, writeLines, writeLines, writeLines, writeStringToFile, writeStringToFile, writeStringToFile, writeStringToFile, writeStringToFile, writeStringToFilepublic static final String DEFAULT_ENCODING
public static String normalizeFilePath(URL url, String encoding) throws UnsupportedEncodingException
url - file uri to resourceencoding - - Java encoding namesUnsupportedEncodingException - if encoding is unknownpublic static void extractResources(String resourceName, Class callingClass, File outputDir, boolean keepParentDirectory) throws IOException
resourceName - - full resource namecallingClass - - classloader for this class is usedoutputDir - - extract to this directorykeepParentDirectory - true - full structure of directories is kept; false - file - removed all directories, directory -
started from resource pointIOException - if any errorspublic static File findFileByName(File folder, String filename, boolean recursive)
folder - Folder where to look for the filefilename - Name of the filerecursive - If true, the file will be looked for in all subfolders, otherwise it will be looked inside the given folderCopyright © 2019. All rights reserved.