public class FileUtils extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
checkFile(File f,
boolean allowOverwrite)
Checks whether a given path is a file, does not exist (unless
allowOverwrite is true) and is writable |
static boolean |
checkFile(String filename,
boolean allowOverwrite)
Checks whether a given path is a file, does not exist (unless
allowOverwrite is true) and is writable |
static String |
getExtension(File file,
boolean includeMultipleExtensions,
boolean includeLeadingDot)
Gets the extension for a given file
|
static String |
getExtension(String path,
boolean includeMultipleExtensions,
boolean includeLeadingDot)
Gets the extension for a given path
|
public static boolean checkFile(String filename, boolean allowOverwrite)
allowOverwrite
is true) and is writablefilename
- Filename to checkallowOverwrite
- Whether overwriting of existing files is allowedpublic static boolean checkFile(File f, boolean allowOverwrite)
allowOverwrite
is true) and is writablef
- File to checkallowOverwrite
- Whether overwriting of existing files is allowedpublic static String getExtension(String path, boolean includeMultipleExtensions, boolean includeLeadingDot) throws IOException
path
- PathincludeMultipleExtensions
- Whether multiple extensions are returned e.g. .txt.gz
includeLeadingDot
- Whether the leading .
on the extension is returnedIOException
- Thrown if the path is not a filepublic static String getExtension(File file, boolean includeMultipleExtensions, boolean includeLeadingDot) throws IOException
file
- FileincludeMultipleExtensions
- Whether multiple extensions are returned e.g. .txt.gz
includeLeadingDot
- Whether the leading .
on the extension is returnedIOException
- Thrown if the filenameCopyright © 2015. All rights reserved.