public final class FileUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
FileUtils.DirAndJarFilter
Filter for searching for .jar Files and Directories.
|
static class |
FileUtils.DirectoryFilter
Filter for searching for Directories.
|
static class |
FileUtils.FilesFilter
Filter for searching for Files.
|
static class |
FileUtils.JarFilter
Filter for searching for .jar Files.
|
static class |
FileUtils.MetaInfFilter
Filter for searching for MetaFiles.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
ALL_META
integer for ALL_Meta.
|
static int |
MAC_META
integer for Mac_Meta.
|
static int |
UNIX_META
integer for Unix_Meta.
|
static int |
WINDOWS_META
integer for Windows_Meta.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsOnlyMetaFiles(File check)
Tests whether the specified
File only contains MetaFiles of one type or not. |
static boolean |
containsOnlyMetaFiles(File check,
int mode)
Tests whether the specified
Directory only contains MetaFiles of the specified
OS. |
static void |
copyContent(File srcDir,
File destDir,
FileFilter filter,
boolean recursive)
Copies the Content of the specified
Directory. |
static void |
copyFile(File inFile,
File outFile)
Copies the specified
File Note: exception thrown and not handled to avoid logger call if it is
necessary to use logger in this class return boolean and handle exceptions. |
static void |
deleteContent(File srcDir,
boolean recursive)
Deletes the Content of the specified
Directory. |
static void |
deleteDir(File srcDir)
Deletes the Given Folder.
|
static void |
extractJar(File jar,
File dest,
FileFilter filter)
Extracts given Jar File to given Folder.
|
static String |
getExt(File file)
Getter for the Filestype of the specified
File. |
static String |
getName(File file)
Getter for the name of the specified
File. |
static boolean |
isMetaFile(File check)
Tests whether the specified
File is a MetaFiles or not. |
static boolean |
isMetaFile(File check,
int mode)
Tests whether the specified
File is a MetaFile of the tested OS or not. |
public static final int MAC_META
public static final int UNIX_META
public static final int WINDOWS_META
public static final int ALL_META
public static boolean isMetaFile(File check)
File is a MetaFiles or not.check - File to be testedFile is a MetaFileisMetaFile(java.io.File, int)public static boolean isMetaFile(File check, int mode)
File is a MetaFile of the tested OS or not.check - File to be testedmode - Number of OS to be testedFile is a MetaFile of the tested OSpublic static String getName(File file)
File.file - given FileFileNamepublic static String getExt(File file)
File.file - given fileStringpublic static boolean containsOnlyMetaFiles(File check)
File only contains MetaFiles of one type or not.check - File to be testedMetaFilescontainsOnlyMetaFiles(java.io.File, int)public static boolean containsOnlyMetaFiles(File check, int mode)
Directory only contains MetaFiles of the specified
OS.check - Directory, which is going to get tested.mode - OsMetaFiles of the tested OsIllegalArgumentException - throws IllegalArgumentException if the File isn't a
DirectoryisMetaFile(java.io.File, int)public static void copyFile(File inFile, File outFile) throws FileNotFoundException, IOException
File Note: exception thrown and not handled to avoid logger call if it is
necessary to use logger in this class return boolean and handle exceptions.inFile - input FileoutFile - target FileFileNotFoundException - FileNotFoundExceptionIOException - IOExceptionpublic static void copyContent(File srcDir, File destDir, FileFilter filter, boolean recursive) throws FileNotFoundException, IOException
Directory. It uses FileUtils.FilesFilter. If it is a
File, it copies the File and if it is a Directory, the method start recursive again with the
found DirectorysrcDir - Source DirectorydestDir - Target Directoryfilter - Filterrecursive - recursiveFileNotFoundException - throws FileNotFoundException if:
File is not a DirectoryFile is not a DirectoryIOException - IOExceptionpublic static void deleteContent(File srcDir, boolean recursive) throws IOException
Directory.srcDir - Directoryrecursive - recursiveIOException - IOException
public static void deleteDir(File srcDir) throws IOException
srcDir - given DirectoryIOException - IOException
public static void extractJar(File jar, File dest, FileFilter filter) throws IOException
jar - Jar Filedest - Directoryfilter - filterIOException - IOException
Copyright © 2012–2026 cismet GmbH. All rights reserved.