Class FileUtils
Path-related methods
Methods exist to retrieve the components of a typical file path. For example/www/hosted/mysite/index.html, can be broken into:
 /www/hosted/mysite/index-- retrievable throughremoveExtension(java.lang.String)html-- retrievable throughgetExtension(java.lang.String)
File-related methods
There are methods to create a File from a URL, copy a
 File to another File,
 copy a URL's contents to a File,
 as well as methods to delete and clean a directory.
 
Common File manipulation routines.
Taken from the commons-utils repo. Also code from Alexandria's FileUtils. And from Avalon Excalibur's IO. And from Ant.
- 
Nested Class Summary
Nested Classes - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic voidcleanDirectory(File directory) Deprecated.static booleancontentEquals(File file1, File file2) Compare the contents of two files to determine if they are equal or not.static voidcopyDirectory(File sourceDirectory, File destinationDirectory) Deprecated.useorg.apache.commons.io.FileUtils.copyDirectory()static voidcopyDirectory(File sourceDirectory, File destinationDirectory, String includes, String excludes) Deprecated.useorg.apache.commons.io.FileUtils.copyDirectory()static voidcopyDirectoryStructure(File sourceDirectory, File destinationDirectory) Deprecated.useorg.apache.commons.io.FileUtils.copyDirectory()static voidDeprecated.usejava.nio.Files.copy(source.toPath(), destination.toPath(), LinkOption.NOFOLLOW_LINKS, StandardCopyOption.REPLACE_EXISTING)static voidcopyFile(File from, File to, String encoding, FileUtils.FilterWrapper... wrappers) If wrappers is null or empty, the file will be copied only if to.lastModified() < from.lastModified()static voidcopyFile(File from, File to, String encoding, FileUtils.FilterWrapper[] wrappers, boolean overwrite) If wrappers is null or empty, the file will be copy only if to.lastModified() < from.lastModified() or if overwrite is truestatic voidcopyFileToDirectory(File source, File destinationDirectory) Deprecated.useorg.apache.commons.io.FileUtils.copyFileToDirectory()static voidcopyURLToFile(URL source, File destination) Deprecated.usejava.nio.Files.copy(source.openStream(), destination.toPath(), StandardCopyOption.REPLACE_EXISTING)static FilecreateSymbolicLink(File symlink, File target) Create a new symbolic link, possibly replacing an existing symbolic link.static FilecreateTempFile(String prefix, String suffix, File parentDir) Deprecated.usejava.nio.Files.createTempFile()static voidDeprecated.usejava.nio.files.Files.delete(file.toPath())static voiddeleteDirectory(File directory) Deprecated.useorg.apache.commons.io.FileUtils.deleteDirectory()static voiddeleteDirectory(String directory) Deprecated.useorg.apache.commons.io.FileUtils.deleteDirectory()static booleandeleteLegacyStyle(File file) Deprecated.usejava.nio.files.Files.delete(file.toPath())static StringDeprecated.usePaths.get(path).getParent().getName()static StringDeprecated.useorg.apache.commons.io.FilenameUtils.getExtensionstatic voidfileAppend(String fileName, String data) Deprecated.usejava.nio.files.Files.write(filename, data.getBytes(), StandardOpenOption.APPEND, StandardOpenOption.CREATE)static voidfileAppend(String fileName, String encoding, String data) Deprecated.usejava.nio.files.Files.write(filename, data.getBytes(encoding), StandardOpenOption.APPEND, StandardOpenOption.CREATE)static voidfileDelete(String fileName) Deprecated.useFiles.delete(Paths.get(fileName))static booleanfileExists(String fileName) Deprecated.usejava.io.File.exists()static StringDeprecated.usePaths.get(path).getName()static StringDeprecated.usenew String(java.nio.files.Files.readAllBytes(file.toPath()))static StringDeprecated.usenew String(java.nio.files.Files.readAllBytes(file.toPath()), encoding)static StringDeprecated.usenew String(java.nio.files.Files.readAllBytes(file))static String[]fileReadArray(File file) Deprecated.usejava.nio.files.Files.readAllLines()static voidDeprecated.usejava.nio.files.Files.write(file.toPath(), data.getBytes(encoding), StandardOpenOption.CREATE)static voidDeprecated.usejava.nio.files.Files.write(filename, data.getBytes(), StandardOpenOption.CREATE)static voidDeprecated.usejava.nio.files.Files.write(Paths.get(filename), data.getBytes(encoding), StandardOpenOption.CREATE)static voidfileWriteArray(File file, String... data) Deprecated.usejava.nio.files.Files.write(file.toPath(), data.getBytes(encoding), StandardOpenOption.CREATE)static voidfileWriteArray(File file, String encoding, String... data) Deprecated.usejava.nio.files.Files.write(file.toPath(), data.getBytes(encoding), StandardOpenOption.CREATE)static voidforceDelete(File file) Deprecated.useorg.apache.commons.io.FileUtils.deleteQuietly()static voidforceDelete(String file) Deprecated.useorg.apache.commons.io.FileUtils.deleteQuietly()static voidforceMkdir(File file) Make a directory.static String[]static StringgetDirectoryNames(File directory, String includes, String excludes, boolean includeBasedir) Return a list of directories as String depending options.getDirectoryNames(File directory, String includes, String excludes, boolean includeBasedir, boolean isCaseSensitive) Return a list of directories as Strings.static StringgetExtension(String filename) Deprecated.useorg.apache.commons.io.FilenameUtils.getExtension()getFileAndDirectoryNames(File directory, String includes, String excludes, boolean includeBasedir, boolean isCaseSensitive, boolean getFiles, boolean getDirectories) Return a list of file names as Strings.getFileNames(File directory, String includes, String excludes, boolean includeBasedir) Return a list of files as String depending options.Return the files contained in the directory, using inclusion and exclusion Ant patterns, including the directory name in each of the filesReturn the files contained in the directory, using inclusion and exclusion Ant patternsstatic String[]getFilesFromExtension(String directory, String... extensions) Given a directory and an array of extensions return an array of compliant files.static booleanisSymbolicLink(File file) Deprecated.usejava.nio.file.Files.isSymbolicLink(file.toPath())static booleanisSymbolicLinkForSure(File file) Deprecated.usejava.nio.file.Files.isSymbolicLink(file.toPath())Deprecated.assumes the platform default character setstatic voidDeprecated.usejava.nio.file.Files.createDirectories(Paths.get(dir))static StringDeprecated.useorg.apache.commons.io.FileNameUtils.normalize()static StringremoveExtension(String filename) Deprecated.useorg.apache.commons.io.FilenameUtils.removeExtension()static voidDeprecated.usejava.nio.Files.move()static FileresolveFile(File baseFile, String filename) Resolve a filefilenameto its canonical form.static longsizeOfDirectory(File directory) Deprecated.useorg.apache.commons.io.FileUtils.sizeOf()static longsizeOfDirectory(String directory) Deprecated.useorg.apache.commons.io.FileUtils.sizeOf()static FileConvert from aURLto aFile.static URL[]Convert the array of Files into a list of URLs. 
- 
Constructor Details
- 
FileUtils
protected FileUtils()protected constructor. 
 - 
 - 
Method Details
- 
getDefaultExcludes
- Returns:
 - the default excludes pattern
 - See Also:
 
 - 
getDefaultExcludesAsList
- Returns:
 - the default excludes pattern as list
 - See Also:
 
 - 
getDefaultExcludesAsString
- Returns:
 - the default excludes pattern as comma separated string.
 - See Also:
 
 - 
dirname
Deprecated.usePaths.get(path).getParent().getName()Returns the directory path portion of a file specification string. Matches the equally named unix command.- Parameters:
 path- the file path- Returns:
 - the directory portion excluding the ending file separator
 
 - 
filename
Deprecated.usePaths.get(path).getName()Returns the filename portion of a path.- Parameters:
 path- the file path- Returns:
 - the filename string with extension
 
 - 
extension
Deprecated.useorg.apache.commons.io.FilenameUtils.getExtensionReturns the extension portion of a file path. This is everything after the last dot '.' in the path (NOT including the dot).- Parameters:
 path- the file path- Returns:
 - the extension of the file
 
 - 
fileExists
Deprecated.usejava.io.File.exists()Check if a file exists.- Parameters:
 fileName- the file path- Returns:
 - true if file exists
 
 - 
fileRead
Deprecated.usenew String(java.nio.files.Files.readAllBytes(file))Note: the file content is read with platform encoding.- Parameters:
 file- the file path- Returns:
 - the file content using the platform encoding
 - Throws:
 IOException- if any
 - 
fileRead
Deprecated.usenew String(java.nio.files.Files.readAllBytes(file.toPath()))Note: the file content is read with platform encoding.- Parameters:
 file- the file path- Returns:
 - the file content using the platform encoding
 - Throws:
 IOException- if any
 - 
fileRead
@Deprecated @Nonnull public static String fileRead(@Nonnull File file, @Nullable String encoding) throws IOException Deprecated.usenew String(java.nio.files.Files.readAllBytes(file.toPath()), encoding)- Parameters:
 file- the file pathencoding- the wanted encoding- Returns:
 - the file content using the specified encoding
 - Throws:
 IOException- if any
 - 
fileReadArray
Deprecated.usejava.nio.files.Files.readAllLines()- Parameters:
 file- the file path- Returns:
 - the file content lines as String[] using the system default encoding. An empty List if the file doesn't exist.
 - Throws:
 IOException- in case of failure
 - 
fileAppend
@Deprecated public static void fileAppend(@Nonnull String fileName, @Nonnull String data) throws IOException Deprecated.usejava.nio.files.Files.write(filename, data.getBytes(), StandardOpenOption.APPEND, StandardOpenOption.CREATE)Appends data to a file. The file is created if it does not exist. Note: the data is written with platform encoding.- Parameters:
 fileName- the path of the file to writedata- the content to write to the file- Throws:
 IOException- if any
 - 
fileAppend
@Deprecated public static void fileAppend(@Nonnull String fileName, @Nullable String encoding, @Nonnull String data) throws IOException Deprecated.usejava.nio.files.Files.write(filename, data.getBytes(encoding), StandardOpenOption.APPEND, StandardOpenOption.CREATE)Appends data to a file. The file will be created if it does not exist.- Parameters:
 fileName- the path of the file to writeencoding- the encoding of the filedata- the content to write to the file- Throws:
 IOException- if any
 - 
fileWrite
@Deprecated public static void fileWrite(@Nonnull String fileName, @Nonnull String data) throws IOException Deprecated.usejava.nio.files.Files.write(filename, data.getBytes(), StandardOpenOption.CREATE)Writes data to a file. The file will be created if it does not exist. Note: the data is written with platform encoding- Parameters:
 fileName- the path of the file to writedata- the content to write to the file- Throws:
 IOException- if any
 - 
fileWrite
@Deprecated public static void fileWrite(@Nonnull String fileName, @Nullable String encoding, @Nonnull String data) throws IOException Deprecated.usejava.nio.files.Files.write(Paths.get(filename), data.getBytes(encoding), StandardOpenOption.CREATE)Writes data to a file. The file will be created if it does not exist.- Parameters:
 fileName- the path of the file to writeencoding- the encoding of the filedata- the content to write to the file- Throws:
 IOException- if any
 - 
fileWrite
@Deprecated public static void fileWrite(@Nonnull File file, @Nullable String encoding, @Nonnull String data) throws IOException Deprecated.usejava.nio.files.Files.write(file.toPath(), data.getBytes(encoding), StandardOpenOption.CREATE)Writes data to a file. The file will be created if it does not exist.- Parameters:
 file- the path of the file to writeencoding- the encoding of the filedata- the content to write to the file- Throws:
 IOException- if any
 - 
fileWriteArray
@Deprecated public static void fileWriteArray(@Nonnull File file, @Nullable String... data) throws IOException Deprecated.usejava.nio.files.Files.write(file.toPath(), data.getBytes(encoding), StandardOpenOption.CREATE)Writes String array data to a file in the systems default encoding. The file will be created if it does not exist.- Parameters:
 file- the path of the file to writedata- the content to write to the file- Throws:
 IOException- if any
 - 
fileWriteArray
@Deprecated public static void fileWriteArray(@Nonnull File file, @Nullable String encoding, @Nullable String... data) throws IOException Deprecated.usejava.nio.files.Files.write(file.toPath(), data.getBytes(encoding), StandardOpenOption.CREATE)Writes String array data to a file. The file is created if it does not exist.- Parameters:
 file- the path of the file to writeencoding- the encoding of the filedata- the content to write to the file- Throws:
 IOException- if any
 - 
fileDelete
Deprecated.useFiles.delete(Paths.get(fileName))Deletes a file.- Parameters:
 fileName- the path of the file to delete
 - 
getFilesFromExtension
public static String[] getFilesFromExtension(@Nonnull String directory, @Nonnull String... extensions) Given a directory and an array of extensions return an array of compliant files.The given extensions should be like "java" and not like ".java".
- Parameters:
 directory- the path of the directoryextensions- an array of expected extensions- Returns:
 - an array of files for the wanted extensions
 
 - 
mkdir
Deprecated.usejava.nio.file.Files.createDirectories(Paths.get(dir))Simple way to make a directory.- Parameters:
 dir- the directory to create- Throws:
 IllegalArgumentException- if the dir contains illegal Windows characters under Windows OS- See Also:
 - 
INVALID_CHARACTERS_FOR_WINDOWS_FILE_NAME
 
 - 
contentEquals
Compare the contents of two files to determine if they are equal or not.- Parameters:
 file1- the first filefile2- the second file- Returns:
 - true if the content of the files are equal or they both don't exist, false otherwise
 - Throws:
 IOException- if any
 - 
toFile
Convert from aURLto aFile.- Parameters:
 url- file URL- Returns:
 - the equivalent 
Fileobject, ornullif the URL's protocol is notfile 
 - 
toURLs
Convert the array of Files into a list of URLs.- Parameters:
 files- the array of files- Returns:
 - the array of URLs
 - Throws:
 IOException- if an error occurs
 - 
removeExtension
Deprecated.useorg.apache.commons.io.FilenameUtils.removeExtension()Remove extension from a path. E.g.foo.txt → foo a\b\c.jpg → a\b\c a\b\c → a\b\c
- Parameters:
 filename- the path of the file- Returns:
 - the filename minus extension
 
 - 
getExtension
Deprecated.useorg.apache.commons.io.FilenameUtils.getExtension()Get extension from a path. E.g.foo.txt → "txt" a\b\c.jpg → "jpg" a\b\c → ""
- Parameters:
 filename- the path of the file- Returns:
 - the extension of filename or "" if none
 
 - 
copyFileToDirectory
@Deprecated public static void copyFileToDirectory(@Nonnull File source, @Nonnull File destinationDirectory) throws IOException Deprecated.useorg.apache.commons.io.FileUtils.copyFileToDirectory()Copy file from source to destination. IfdestinationDirectorydoes not exist, it (and any parent directories) will be created. If a filesourceindestinationDirectoryexists, it will be overwritten.- Parameters:
 source- an existingFileto copydestinationDirectory- a directory to copysourceinto- Throws:
 FileNotFoundException- ifsourceisn't a normal fileIllegalArgumentException- ifdestinationDirectoryisn't a directoryIOException- ifsourcedoes not exist, the file indestinationDirectorycannot be written to, or an IO error occurs during copying
 - 
copyFile
@Deprecated public static void copyFile(@Nonnull File source, @Nonnull File destination) throws IOException Deprecated.usejava.nio.Files.copy(source.toPath(), destination.toPath(), LinkOption.NOFOLLOW_LINKS, StandardCopyOption.REPLACE_EXISTING)Copy file from source to destination. The directories up todestinationwill be created if they don't already exist.destinationwill be overwritten if it already exists.- Parameters:
 source- an existing non-directoryFileto copy bytes fromdestination- a non-directoryFileto write bytes to (possibly overwriting)- Throws:
 IOException- ifsourcedoes not exist,destinationcannot be written to, or an IO error occurs during copyingFileNotFoundException- ifdestinationis a directory
 - 
copyURLToFile
Deprecated.usejava.nio.Files.copy(source.openStream(), destination.toPath(), StandardCopyOption.REPLACE_EXISTING)Copies bytes from the URLsourceto a filedestination. The directories up todestinationwill be created if they don't already exist.destinationwill be overwritten if it already exists.- Parameters:
 source- aURLto copy bytes fromdestination- a non-directoryFileto write bytes to (possibly overwriting)- Throws:
 IOException- ifsourceURL cannot be openeddestinationcannot be written to- an IO error occurs during copying
 
 - 
normalize
Deprecated.useorg.apache.commons.io.FileNameUtils.normalize()Normalize a path. Eliminates "/../" and "/./" in a string. Returnsnullif the ..'s went past the root. Eg:/foo// → /foo/ /foo/./ → /foo/ /foo/../bar → /bar /foo/../bar/ → /bar/ /foo/../bar/../baz → /baz //foo//./bar → /foo/bar /../ → null
- Parameters:
 path- the path to normalize- Returns:
 - the normalized String, or 
nullif too many ..'s 
 - 
resolveFile
Resolve a filefilenameto its canonical form. Iffilenameis relative (doesn't start with/), it is resolved relative tobaseFile. Otherwise it is treated as a normal root-relative path.- Parameters:
 baseFile- where to resolvefilenamefrom, iffilenameis relativefilename- absolute or relative file path to resolve- Returns:
 - the canonical 
Fileoffilename 
 - 
forceDelete
Deprecated.useorg.apache.commons.io.FileUtils.deleteQuietly()Delete a file. If file is directory, delete it and all sub-directories.- Parameters:
 file- the file path- Throws:
 IOException- if any
 - 
forceDelete
Deprecated.useorg.apache.commons.io.FileUtils.deleteQuietly()Delete a file. If file is directory, delete it and all sub-directories.- Parameters:
 file- a file- Throws:
 IOException- if any
 - 
delete
Deprecated.usejava.nio.files.Files.delete(file.toPath())Deletes a file.- Parameters:
 file- the file to delete- Throws:
 IOException- if the file cannot be deleted
 - 
deleteLegacyStyle
Deprecated.usejava.nio.files.Files.delete(file.toPath())- Parameters:
 file- the file- Returns:
 - true / false
 
 - 
forceMkdir
Make a directory.- Parameters:
 file- not null- Throws:
 IOException- if a file already exists with the specified name or the directory is unable to be createdIllegalArgumentException- if the file contains illegal Windows characters under Windows OS.- See Also:
 - 
INVALID_CHARACTERS_FOR_WINDOWS_FILE_NAME
 
 - 
deleteDirectory
Deprecated.useorg.apache.commons.io.FileUtils.deleteDirectory()Recursively delete a directory.- Parameters:
 directory- a directory- Throws:
 IOException- if any
 - 
deleteDirectory
Deprecated.useorg.apache.commons.io.FileUtils.deleteDirectory()Recursively delete a directory.- Parameters:
 directory- a directory- Throws:
 IOException- if any
 - 
cleanDirectory
Deprecated.useorg.apache.commons.io.FileUtils.cleanDirectory()Remove all files from a directory without deleting it.- Parameters:
 directory- a directory- Throws:
 IOException- if any. This can leave cleaning in a half-finished state where some but not all files have been deleted.
 - 
sizeOfDirectory
Deprecated.useorg.apache.commons.io.FileUtils.sizeOf()Recursively count size of a directory.- Parameters:
 directory- a directory- Returns:
 - size of directory in bytes
 
 - 
sizeOfDirectory
Deprecated.useorg.apache.commons.io.FileUtils.sizeOf()Recursively count size of a directory.- Parameters:
 directory- a directory- Returns:
 - size of directory in bytes
 
 - 
getFiles
@Nonnull public static List<File> getFiles(@Nonnull File directory, @Nullable String includes, @Nullable String excludes) throws IOException Return the files contained in the directory, using inclusion and exclusion Ant patterns, including the directory name in each of the files- Parameters:
 directory- the directory to scanincludes- the Ant includes pattern, comma separatedexcludes- the Ant excludes pattern, comma separated- Returns:
 - a list of File objects
 - Throws:
 IOException- in case of failure.- See Also:
 
 - 
getFiles
@Nonnull public static List<File> getFiles(@Nonnull File directory, @Nullable String includes, @Nullable String excludes, boolean includeBasedir) throws IOException Return the files contained in the directory, using inclusion and exclusion Ant patterns- Parameters:
 directory- the directory to scanincludes- the includes pattern, comma separatedexcludes- the excludes pattern, comma separatedincludeBasedir- true to include the base dir in each file- Returns:
 - a list of File objects
 - Throws:
 IOException- in case of failure.- See Also:
 
 - 
getFileNames
@Nonnull public static List<String> getFileNames(@Nonnull File directory, @Nullable String includes, @Nullable String excludes, boolean includeBasedir) throws IOException Return a list of files as String depending options. This method use case sensitive file name.- Parameters:
 directory- the directory to scanincludes- the Ant includes pattern, comma separatedexcludes- the Ant excludes pattern, comma separatedincludeBasedir- true to include the base directory in each String of file- Returns:
 - a list of file names
 - Throws:
 IOException- in case of failure
 - 
getDirectoryNames
@Nonnull public static List<String> getDirectoryNames(@Nonnull File directory, @Nullable String includes, @Nullable String excludes, boolean includeBasedir) throws IOException Return a list of directories as String depending options. This method use case sensitive file name.- Parameters:
 directory- the directory to scanincludes- the Ant includes pattern, comma separatedexcludes- the Ant excludes pattern, comma separatedincludeBasedir- true to include the base dir in each String of file- Returns:
 - a list of directories as String
 - Throws:
 IOException- in case of failure.
 - 
getDirectoryNames
@Nonnull public static List<String> getDirectoryNames(@Nonnull File directory, @Nullable String includes, @Nullable String excludes, boolean includeBasedir, boolean isCaseSensitive) throws IOException Return a list of directories as Strings.- Parameters:
 directory- the directory to scanincludes- the Ant includes pattern, comma separatedexcludes- the Ant excludes pattern, comma separatedincludeBasedir- true to include the base directory in each String of fileisCaseSensitive- true if case sensitive- Returns:
 - a list of directories as String
 - Throws:
 IOException- in case of failure
 - 
getFileAndDirectoryNames
@Nonnull public static List<String> getFileAndDirectoryNames(File directory, @Nullable String includes, @Nullable String excludes, boolean includeBasedir, boolean isCaseSensitive, boolean getFiles, boolean getDirectories) Return a list of file names as Strings.- Parameters:
 directory- the directory to scanincludes- the Ant includes pattern, comma separatedexcludes- the Ant excludes pattern, comma separatedincludeBasedir- true to include the base directory in each String of fileisCaseSensitive- true if case sensitivegetFiles- true to include regular filesgetDirectories- true to include directories- Returns:
 - a list of file names
 
 - 
copyDirectory
@Deprecated public static void copyDirectory(@Nonnull File sourceDirectory, @Nonnull File destinationDirectory) throws IOException Deprecated.useorg.apache.commons.io.FileUtils.copyDirectory()Copy the contents of a directory into another one.- Parameters:
 sourceDirectory- the source directory. If the source does not exist, the method simply returns.destinationDirectory- the target directory; will be created if it doesn't exist- Throws:
 IOException- if any
 - 
copyDirectory
@Deprecated public static void copyDirectory(@Nonnull File sourceDirectory, @Nonnull File destinationDirectory, @Nullable String includes, @Nullable String excludes) throws IOException Deprecated.useorg.apache.commons.io.FileUtils.copyDirectory()Copy the contents of a directory into another one.- Parameters:
 sourceDirectory- the source directorydestinationDirectory- the target directoryincludes- Ant include patternexcludes- Ant exclude pattern- Throws:
 IOException- if the source is a file or cannot be copied- See Also:
 
 - 
copyDirectoryStructure
@Deprecated public static void copyDirectoryStructure(@Nonnull File sourceDirectory, @Nonnull File destinationDirectory) throws IOException Deprecated.useorg.apache.commons.io.FileUtils.copyDirectory()Copies an entire directory structure.Note:
- It will include empty directories.
 - The 
sourceDirectorymust exist. 
- Parameters:
 sourceDirectory- the existing directory to be copieddestinationDirectory- the new directory to be created- Throws:
 IOException- if any
 - 
rename
Deprecated.usejava.nio.Files.move()Renames a file, even if that involves crossing file system boundaries.This will remove
to(if it exists), ensure thatto's parent directory exists and movefrom, which involves deletingfromas well.- Parameters:
 from- the file to moveto- the new file name- Throws:
 IOException- if anything bad happens during this process. Note thattomay have been deleted already when this happens.
 - 
createTempFile
@Deprecated public static File createTempFile(@Nonnull String prefix, @Nonnull String suffix, @Nullable File parentDir) Deprecated.usejava.nio.Files.createTempFile()Create a temporary file in a given directory.
The file denoted by the returned abstract pathname did not exist before this method was invoked, any subsequent invocation of this method will yield a different file name.
The filename is prefixNNNNNsuffix where NNNN is a random number
This method is different to
File.createTempFile(String, String, File)as it doesn't create the file itself. It uses the location pointed to by java.io.tmpdir when the parentDir attribute is null.To automatically delete the file created by this method, use the
File.deleteOnExit()method.- Parameters:
 prefix- prefix before the random numbersuffix- file extension; include the '.'parentDir- directory to create the temporary file in-java.io.tmpdirused if not specified- Returns:
 - a File reference to the new temporary file.
 
 - 
loadFile
Deprecated.assumes the platform default character setNote: the file content is read with platform encoding.- Parameters:
 file- the file- Returns:
 - a List containing every every line not starting with # and not empty
 - Throws:
 IOException- if any
 - 
isSymbolicLink
Deprecated.usejava.nio.file.Files.isSymbolicLink(file.toPath())Checks whether a given file is a symbolic link.- Parameters:
 file- the file to check- Returns:
 - true if symbolic link false otherwise.
 - Throws:
 IOException- in case of failure.
 - 
isSymbolicLinkForSure
Deprecated.usejava.nio.file.Files.isSymbolicLink(file.toPath())Checks whether a given file is a symbolic link.- Parameters:
 file- the file to check- Returns:
 - true if and only if we reliably can say this is a symlink
 - Throws:
 IOException- in case of failure
 - 
createSymbolicLink
@Nonnull public static File createSymbolicLink(@Nonnull File symlink, @Nonnull File target) throws IOException Create a new symbolic link, possibly replacing an existing symbolic link.- Parameters:
 symlink- the link nametarget- the target- Returns:
 - the linked file
 - Throws:
 IOException- in case of an error- See Also:
 
 
 - 
 
org.apache.commons.io.FileUtils.cleanDirectory()