Constructor and Description |
---|
FileUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkClass(String classname)
Checks 'by name' if a particular class exists.
|
static void |
copyToFile(InputStream in,
File file)
Reads all data from the given input stream and copies them
to to a file.
|
static String |
getClassPath(Class<?> clazz)
Find the path from which a given class was loaded.
|
static String |
getFileExtension(String name)
Extracts the extension part of a pathname as a string.
|
static Manifest |
getJarManifest(Class<?> clazz)
Finds the manifest (from META-INF/MANIFEST.MF) of the JAR file
from which clazz was loaded.
|
static void |
main(String[] args) |
static void |
printClassPath()
Lists (to System.out) the paths where classes are loaded from.
|
static String |
stripFileExtension(String name)
Removes the extension part of a pathname.
|
public FileUtils()
public static String stripFileExtension(String name)
name
- the pathnamepublic static String getFileExtension(String name)
name
- the pathnamepublic static String getClassPath(Class<?> clazz)
clazz
- a class.public static void printClassPath()
public static boolean checkClass(String classname)
classname
- fully qualified name of the class, e.g. imagingbook.lib.util.FileUtilstrue
if the class was found, false
otherwisepublic static void copyToFile(InputStream in, File file) throws IOException
in
- the input streamfile
- the output fileIOException
- if anything goes wrongpublic static Manifest getJarManifest(Class<?> clazz)
clazz
- A class in the JAR file of interest.Manifest
object or null if clazz
was not loaded from a JAR file.Copyright © 2006–2017, Wilhelm Burger, Mark J. Burge (BSD 2-Clause Simplified License)