public final class FileUtil extends Object
Constructor and Description |
---|
FileUtil() |
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 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 objectnull
public static String getFilenameExtension(String name)
null
is returned.name
- File namenull
public 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 error