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