
public final class FileUtil extends Object
| Modifier | Constructor and Description |
|---|---|
private |
FileUtil()
Fake Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static String |
getFilenameExtension(File file)
Returns the lower case extension of the selected file.
|
static String |
getFilenameExtension(String name)
Returns the lower case extension of the selected file.
|
static File |
locateFile(String name,
String basedir)
Try to locate an file in the filesystem, given a partial name and a prefix.
|
static InputStream |
openSystemFile(String filename)
Try to open a file, first trying the file system, then falling back to the
classpath.
|
static String |
slurp(InputStream is)
Load an input stream (e.g. a Java resource) into a String buffer.
|
static InputStream |
tryGzipInput(InputStream in)
Try to open a stream as gzip, if it starts with the gzip magic.
|
public static String getFilenameExtension(File file)
null is returned.file - File objectnullpublic static String getFilenameExtension(String name)
null is returned.name - File namenullpublic static InputStream openSystemFile(String filename) throws FileNotFoundException
filename - File name in system notationFileNotFoundException - When no file was found.public static InputStream tryGzipInput(InputStream in) throws IOException
in - original input streamGZIPInputStream if appropriate.IOException - on IO errorpublic static File locateFile(String name, String basedir)
name - file namebasedir - extra base directory to trynull otherwisepublic static String slurp(InputStream is) throws IOException
is - Input streamIOException - on IO errors