|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectrails.util.ResourceLoader
public final class ResourceLoader
Class ResourceLoader is an utility class to load a resource from a filename and a list of directory.
| Field Summary | |
|---|---|
static java.awt.Font |
defaultFont
|
static java.lang.String |
defaultFontName
|
static int |
defaultFontSize
|
static int |
defaultFontStyle
|
static java.lang.String |
keyContentType
|
protected static org.apache.log4j.Logger |
log
|
| Constructor Summary | |
|---|---|
ResourceLoader()
|
|
| Method Summary | |
|---|---|
static byte[] |
getBytesFromFile(java.lang.String filename,
java.util.List<java.lang.String> directories,
boolean cachedOnly,
boolean ignoreFail)
Return the content of the specified file as an array of byte. |
static javax.swing.text.Document |
getDocument(java.lang.String filename,
java.util.List<java.lang.String> directories)
Return the first Document from file of name filename in the list of directories. |
static java.io.InputStream |
getInputStream(java.lang.String filename,
java.util.List<java.lang.String> directories)
Return the first InputStream from file of name filename in the list of directories. |
static java.io.InputStream |
getInputStream(java.lang.String filename,
java.util.List<java.lang.String> directories,
boolean remote,
boolean cachedOnly,
boolean ignoreFail)
Return the first InputStream from file of name filename in the list of directories. |
static java.io.InputStream |
getInputStreamIgnoreFail(java.lang.String filename,
java.util.List<java.lang.String> directories)
Return the first InputStream from file of name filename in the list of directories, tell the getInputStream not to complain if not found. |
static java.lang.Object |
getNewObject(java.lang.String className,
java.util.List<java.lang.String> directories)
Create an instance of the class whose name is in parameter. |
static java.lang.Object |
getNewObject(java.lang.String className,
java.util.List<java.lang.String> directories,
java.lang.Object[] parameter)
Create an instance of the class whose name is in parameter, using parameters. |
static java.io.OutputStream |
getOutputStream(java.lang.String filename,
java.util.List<java.lang.String> directories)
Return the first OutputStream from file of name filename in the list of directories. |
static java.lang.String |
getPathSeparator()
Give the String to mark directories. |
static void |
purgeFileCache()
empty the cache so that all files have to be reloaded |
static void |
putIntoFileCache(java.lang.String mapKey,
byte[] data)
Force adding the given data as belonging to the given key in the file cache. |
static void |
putIntoFileCache(java.lang.String filename,
java.util.List<java.lang.String> directories,
byte[] data)
Force adding the given data as belonging to the given filename in the file cache. |
static void |
setDataServer(java.lang.String server,
int port)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String keyContentType
public static final java.lang.String defaultFontName
public static final int defaultFontStyle
public static final int defaultFontSize
public static final java.awt.Font defaultFont
protected static org.apache.log4j.Logger log
| Constructor Detail |
|---|
public ResourceLoader()
| Method Detail |
|---|
public static void setDataServer(java.lang.String server,
int port)
public static java.lang.String getPathSeparator()
public static void purgeFileCache()
public static java.io.InputStream getInputStreamIgnoreFail(java.lang.String filename,
java.util.List<java.lang.String> directories)
filename - Name of the file to load.directories - List of directories to search (in order).
public static java.io.InputStream getInputStream(java.lang.String filename,
java.util.List<java.lang.String> directories)
filename - Name of the file to load.directories - List of directories to search (in order).
public static java.io.InputStream getInputStream(java.lang.String filename,
java.util.List<java.lang.String> directories,
boolean remote,
boolean cachedOnly,
boolean ignoreFail)
filename - Name of the file to load.directories - List of directories to search (in order).remote - Ask the server for the stream.cachedOnly - Only look in the cache file, do not try to load the
file from permanent storage.ignoreFail - (=don't complain) if file not found
public static byte[] getBytesFromFile(java.lang.String filename,
java.util.List<java.lang.String> directories,
boolean cachedOnly,
boolean ignoreFail)
filename - Name of the file to load.directories - List of directories to search (in order).cachedOnly - Only look in the cache file, do not try to load the
file from permanent storage.
public static java.io.OutputStream getOutputStream(java.lang.String filename,
java.util.List<java.lang.String> directories)
filename - Name of the file to load.directories - List of directories to search (in order).
public static javax.swing.text.Document getDocument(java.lang.String filename,
java.util.List<java.lang.String> directories)
filename - Name of the file to load.directories - List of directories to search (in order).
public static java.lang.Object getNewObject(java.lang.String className,
java.util.List<java.lang.String> directories)
className - The name of the class to use.directories - List of directories to search (in order).
public static java.lang.Object getNewObject(java.lang.String className,
java.util.List<java.lang.String> directories,
java.lang.Object[] parameter)
className - The name of the class to use, must not be null.directories - List of directories to search (in order), must not be
null.parameter - Array of parameters to pass to the constructor, can be
null.
public static void putIntoFileCache(java.lang.String filename,
java.util.List<java.lang.String> directories,
byte[] data)
filename - Name of the Image file to add.directories - List of directories to search (in order).data - File content to add.
public static void putIntoFileCache(java.lang.String mapKey,
byte[] data)
mapKey - Key to use in the cache.data - File content to add.getMapKey(String, List),
getMapKey(String[], List)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||