ptolemy.util
Class ClassUtilities
- java.lang.Object
-
- ptolemy.util.ClassUtilities
-
public class ClassUtilities extends java.lang.ObjectA collection of utilities for manipulating classes. These utilities do not depend on any other ptolemy.* packages.- Since:
- Ptolemy II 4.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static java.net.URLjarURLEntryResource(java.lang.String jarURLString)Lookup a jar URL and return the resource.static java.lang.StringlookupClassAsResource(java.lang.String necessaryClass)Given a dot separated classname, return the jar file or directory where the class can be found.
-
-
-
Method Detail
-
jarURLEntryResource
public static java.net.URL jarURLEntryResource(java.lang.String jarURLString) throws java.io.IOExceptionLookup a jar URL and return the resource. A resource is a file such as a class file or image file that is found in the classpath. A jar URL is a URL that refers to a resource in a jar file. For example,file://./foo.jar!/a/b/c.classis a jar URL that refers to thea/b/c.classresource infoo.jar. If this method is called withfile://./foo.jar!/a/b/c.classthen it will returna/b/c.classifa/b/c.classcan be found as a resource in the class loader that loaded this class (ptolemy.util.ClassUtilities). If the resource cannot be found, then an IOException is thrown. If the jarURLString parameter does not contain!/, then return null. Note that everything before the!/is removed before searching the classpath.This method is necessary because Web Start uses jar URL, and there are some cases where if we have a jar URL, then we may need to strip off the jar:url!/ part so that we can search for the {entry} as a resource.
- Parameters:
jarURLString- The string containing the jar URL.- Returns:
- The resource, if any.If the spec string does not
contain
!/, then return null. - Throws:
java.io.IOException- If this method cannot convert the specification to a URL.- See Also:
JarURLConnection
-
lookupClassAsResource
public static java.lang.String lookupClassAsResource(java.lang.String necessaryClass)
Given a dot separated classname, return the jar file or directory where the class can be found.- Parameters:
necessaryClass- The dot separated class name, for example "ptolemy.util.ClassUtilities"- Returns:
- If the class can be found as a resource, return the directory or jar file where the necessary class can be found. otherwise, return null. If the resource is found in a directory, then the return value will always have forward slashes, it will never use backslashes.
-
-
DMelt 3.0 © DataMelt by jWork.ORG