|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.croftsoft.core.lang.ClassLib
public final class ClassLib
Static methods to complement the java.lang.Class methods.
Class| Method Summary | |
|---|---|
static Image |
getResourceAsImage(Class relativeClass,
String filename)
Loads an Image as a class resource. |
static String |
getResourceAsText(Class relativeClass,
String filename)
Loads a resource into memory as a String. |
static String |
getShortName(Class c)
Returns the name of the Class without the package prefix. |
static void |
main(String[] args)
|
static boolean |
test(String[] args)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void main(String[] args)
public static boolean test(String[] args)
public static String getResourceAsText(Class relativeClass,
String filename)
throws IOException
Useful for loading a text file from a JAR on the classpath.
Implemented using Class.getResourceAsStream(). Review of the documentation of this method is advised in order to understand the relative search path.
relativeClass - The Class used for the text file search.filename - The path to the file, usually started by "/".
IOExceptionClass.getResourceAsStream(java.lang.String)
public static Image getResourceAsImage(Class relativeClass,
String filename)
throws IOException
Useful for when you need to load an image file from a JAR.
IOExceptionpublic static String getShortName(Class c)
For example, this method would return "ClassLib" for class com.croftsoft.core.lang.ClassLib.
java.lang.Class#getName(java.lang.String)
|
CroftSoft Javadoc | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||