|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opensourcephysics.tools.ResourceLoader
public class ResourceLoader
This defines static methods for loading resources.
Field Summary | |
---|---|
protected static boolean |
cacheEnabled
|
protected static java.util.ArrayList<java.lang.String> |
extractExtensions
|
protected static int |
maxPaths
|
protected static java.util.Hashtable<java.lang.String,Resource> |
resources
|
protected static java.util.ArrayList<java.lang.String> |
searchPaths
|
protected static java.net.URLClassLoader |
xsetZipLoader
|
protected static java.util.Map<java.lang.String,java.net.URLClassLoader> |
zipLoaders
|
Method Summary | |
---|---|
static void |
addExtractExtension(java.lang.String extension)
Adds an extension to the end of the extractExtensions list. |
static void |
addSearchPath(java.lang.String base)
Adds a path at the beginning of the searchPaths list. |
static java.applet.AudioClip |
getAudioClip(java.lang.String path)
|
static java.awt.image.BufferedImage |
getBufferedImage(java.lang.String path)
|
static javax.swing.ImageIcon |
getIcon(java.lang.String path)
|
static java.awt.Image |
getImage(java.lang.String path)
|
static Resource |
getResource(java.lang.String name)
Gets a resource specified by name. |
static Resource |
getResource(java.lang.String name,
boolean searchFiles)
Gets a resource specified by name and Class. |
static Resource |
getResource(java.lang.String name,
java.lang.Class<?> type)
Gets a resource specified by name and Class. |
static Resource |
getResource(java.lang.String name,
java.lang.Class<?> type,
boolean searchFiles)
Gets a resource specified by name and Class. |
static Resource |
getResource(java.lang.String basePath,
java.lang.String name)
Gets a resource specified by base path and name. |
static Resource |
getResource(java.lang.String basePath,
java.lang.String name,
boolean searchFiles)
Gets a resource specified by base path and name. |
static Resource |
getResource(java.lang.String basePath,
java.lang.String name,
java.lang.Class<Resource> type)
Gets a resource specified by base path, name and class. |
static Resource |
getResource(java.lang.String basePath,
java.lang.String name,
java.lang.Class<Resource> type,
boolean searchFiles)
Gets a resource specified by base path, name and class. |
static java.lang.String |
getString(java.lang.String path)
|
static boolean |
isCacheEnabled()
Gets the cacheEnabled property. |
static java.io.InputStream |
openInputStream(java.lang.String path)
|
static java.io.Reader |
openReader(java.lang.String path)
|
static void |
removeSearchPath(java.lang.String base)
Removes a path from the searchPaths list. |
static void |
setCacheEnabled(boolean enabled)
Sets the cacheEnabled property. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static java.util.ArrayList<java.lang.String> searchPaths
protected static int maxPaths
protected static java.util.Hashtable<java.lang.String,Resource> resources
protected static boolean cacheEnabled
protected static java.util.Map<java.lang.String,java.net.URLClassLoader> zipLoaders
protected static java.net.URLClassLoader xsetZipLoader
protected static java.util.ArrayList<java.lang.String> extractExtensions
Method Detail |
---|
public static Resource getResource(java.lang.String name)
name
- the file or URL name
public static Resource getResource(java.lang.String name, boolean searchFiles)
name
- the file or URL namesearchFiles
- true to search files
public static Resource getResource(java.lang.String name, java.lang.Class<?> type)
name
- the file or URL nametype
- the Class providing default ClassLoader resource loading
public static Resource getResource(java.lang.String name, java.lang.Class<?> type, boolean searchFiles)
name
- the file or URL nametype
- the Class providing default ClassLoader resource loadingsearchFiles
- true to search files
public static Resource getResource(java.lang.String basePath, java.lang.String name)
basePath
- the base pathname
- the file or URL name
public static Resource getResource(java.lang.String basePath, java.lang.String name, boolean searchFiles)
basePath
- the base pathname
- the file or URL namesearchFiles
- true to search files
public static Resource getResource(java.lang.String basePath, java.lang.String name, java.lang.Class<Resource> type)
basePath
- the base pathname
- the file or URL nametype
- the Class providing ClassLoader resource loading
public static Resource getResource(java.lang.String basePath, java.lang.String name, java.lang.Class<Resource> type, boolean searchFiles)
basePath
- the base pathname
- the file or URL nametype
- the Class providing ClassLoader resource loadingsearchFiles
- true to search files
public static void addSearchPath(java.lang.String base)
base
- the base path to addpublic static void removeSearchPath(java.lang.String base)
base
- the base path to removepublic static void setCacheEnabled(boolean enabled)
enabled
- true to enable the cachepublic static boolean isCacheEnabled()
public static void addExtractExtension(java.lang.String extension)
extension
- the extension to addpublic static java.io.InputStream openInputStream(java.lang.String path)
public static java.io.Reader openReader(java.lang.String path)
public static java.lang.String getString(java.lang.String path)
public static javax.swing.ImageIcon getIcon(java.lang.String path)
public static java.awt.Image getImage(java.lang.String path)
public static java.awt.image.BufferedImage getBufferedImage(java.lang.String path)
public static java.applet.AudioClip getAudioClip(java.lang.String path)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |