public final class FileUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static void |
close(@Nullable java.io.Closeable closeable)
Close the given
Closeable instance, ignoring nulls, and
logging any thrown IOException. |
static @NotNull java.io.File |
createTempDirectory(@Nullable java.io.File base)
Creates a unique temporary directory in the given directory.
|
static boolean |
delete(@Nullable java.io.File file)
Deletes a file.
|
static @NotNull java.lang.String |
getBitBucket()
Return the bit bucket for the OS.
|
static @Nullable java.lang.String |
getFileExtension(@NotNull java.lang.String fileName)
Returns the (lowercase) file extension for a specified file.
|
static java.io.File |
getResourceAsFile(java.lang.String resource)
Returns a File object for the given resource.
|
static @Nullable java.io.InputStream |
getResourceAsStream(@NotNull java.lang.String resource)
Gets the
InputStream for this resource. |
@Nullable
public static @Nullable java.lang.String getFileExtension(@NotNull
@NotNull java.lang.String fileName)
fileName - the file name to retrieve the file extension from.public static boolean delete(@Nullable
@Nullable java.io.File file)
file - the File to delete@NotNull
public static @NotNull java.io.File createTempDirectory(@Nullable
@Nullable java.io.File base)
throws java.io.IOException
base - the base directory to create a temporary directory withinjava.io.IOException - thrown when a directory cannot be created
within the base directory@NotNull public static @NotNull java.lang.String getBitBucket()
public static void close(@Nullable
@Nullable java.io.Closeable closeable)
Closeable instance, ignoring nulls, and
logging any thrown IOException.closeable - to be closed@Nullable
public static @Nullable java.io.InputStream getResourceAsStream(@NotNull
@NotNull java.lang.String resource)
throws java.io.FileNotFoundException
InputStream for this resource.resource - pathjava.io.FileNotFoundException - if the file could not be foundpublic static java.io.File getResourceAsFile(java.lang.String resource)
resource - pathCopyright© 2012-21 Jeremy Long. All Rights Reserved.