public final class FileUtils
extends java.lang.Object
| Constructor and Description |
|---|
FileUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
createDirectories(java.lang.String location,
java.lang.String... dirsToCreate) |
static void |
deleteDirectory(java.nio.file.Path folder)
Delete the given directory
|
static void |
deleteExclude(java.nio.file.Path toDelete,
java.nio.file.Path... excludes)
Delete the file if it isn't in excluded files.
|
static long |
getCRC32(java.nio.file.Path path)
Get the CRC32 of a File.
|
static java.lang.String |
getFileExtension(java.nio.file.Path path)
Get the extension of the given path.
|
static long |
getFileSizeBytes(java.nio.file.Path path) |
static long |
getFileSizeKiloBytes(java.nio.file.Path path) |
static long |
getFileSizeMegaBytes(java.nio.file.Path path) |
static java.lang.String |
getMD5(java.nio.file.Path path)
Get the MD5 of the given path.
|
static java.nio.file.Path |
getPathOfClass(java.lang.Class<?> classToGetPath) |
static java.lang.String |
getSHA1(java.nio.file.Path path)
Get the SHA1 of the given path.
|
static java.lang.String |
getStringPathOfClass(java.lang.Class<?> classToGetPath) |
static java.lang.String |
hashInput(java.io.InputStream input,
java.lang.String method) |
static java.util.List<java.nio.file.Path> |
list(java.nio.file.Path dir)
Get the list of all files in this directory (not recursively!)
|
static java.util.List<java.nio.file.Path> |
listRecursive(java.nio.file.Path directory)
Return all files in the directory (recursively!)
|
static java.nio.file.Path |
removeExtension(java.nio.file.Path path)
Remove the extension of the given path.
|
static java.lang.String |
removeExtension(java.lang.String fileName) |
public static java.lang.String removeExtension(java.lang.String fileName)
public static java.lang.String getFileExtension(java.nio.file.Path path)
path - given path.public static java.nio.file.Path removeExtension(java.nio.file.Path path)
throws java.io.IOException
path - given path.java.io.IOException - if an I/O error occurred.public static void deleteDirectory(java.nio.file.Path folder)
throws java.io.IOException
folder - folder to delete.java.io.IOException - if an I/O error occurred.public static void deleteExclude(java.nio.file.Path toDelete,
java.nio.file.Path... excludes)
throws java.io.IOException
toDelete - the file to delete.excludes - whitelistjava.io.IOException - if an I/O error occurred.public static java.util.List<java.nio.file.Path> listRecursive(java.nio.file.Path directory)
throws java.io.IOException
directory - the directory to process.java.io.IOException - if an I/O error occurred.public static void createDirectories(java.lang.String location,
java.lang.String... dirsToCreate)
throws java.io.IOException
java.io.IOExceptionpublic static long getFileSizeMegaBytes(java.nio.file.Path path)
throws java.io.IOException
java.io.IOExceptionpublic static long getFileSizeKiloBytes(java.nio.file.Path path)
throws java.io.IOException
java.io.IOExceptionpublic static long getFileSizeBytes(java.nio.file.Path path)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String getStringPathOfClass(java.lang.Class<?> classToGetPath)
public static java.nio.file.Path getPathOfClass(java.lang.Class<?> classToGetPath)
public static java.lang.String hashInput(java.io.InputStream input,
java.lang.String method)
throws java.security.NoSuchAlgorithmException,
java.io.IOException
java.security.NoSuchAlgorithmExceptionjava.io.IOExceptionpublic static java.lang.String getMD5(java.nio.file.Path path)
throws java.io.IOException
path - the path to process.java.io.IOException - is an I/O error occurred.public static java.lang.String getSHA1(java.nio.file.Path path)
throws java.io.IOException
path - the path to process.java.io.IOException - is an I/O error occurred.public static java.util.List<java.nio.file.Path> list(java.nio.file.Path dir)
throws java.io.IOException
dir - the dir to process.java.io.IOException - if an I/O error occurred.public static long getCRC32(java.nio.file.Path path)
throws java.io.IOException
path - the path to processjava.io.IOException - is an I/O error occurred.