|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuiton.util.Resource
public class Resource
Cette class permet de rechercher un fichier en indiquant son nom avec son chemin. Cette librairie ira ensuite chercher ce fichier sur le système de fichier, et s'il n'est pas trouvé dans le classpath. Le fichier peut donc être dans un fichier .jar ou .zip. Exemple :
URL image = Resource.getURL("/images/bidulle.png");
Created: 5 août 2003
| Constructor Summary | |
|---|---|
protected |
Resource()
|
| Method Summary | |
|---|---|
static void |
addClassLoader(ClassLoader classLoader,
URL url)
Permet d'ajouter dans un classloader une nouvelle URL dans lequel il faut rechercher les fichiers. |
static void |
addDefaultClassLoader(URL url)
Permet d'ajouter dans le classloader par defaut une nouvelle URL dans lequel il faut rechercher les fichiers. |
static boolean |
containsDirectDirectory(URL url,
String directory)
Test if an url contains the given directory with no recurse seeking. |
static URL[] |
getClassPathURLsFromJarManifest(URL jarURL)
|
static Properties |
getConfigProperties(String filename)
Deprecated. since 1.1.2, use ApplicationConfig class instead
to ApplicationConfig.setConfigFileName(String)
and search properties file from more folders with
ApplicationConfig.parse(String[]) method |
static Properties |
getConfigProperties(String filename,
Properties parent)
Deprecated. since 1.1.2, use ApplicationConfig class instead
to ApplicationConfig.setConfigFileName(String)
and search properties file from more folders with
ApplicationConfig.parse(String[]) method |
static ImageIcon |
getIcon(String name)
Retourne l'icone demandee. |
static Class |
getPrimitiveClass(Class clazz)
Retourne la classe du type primitf associé avec la classe de de l'objet passé en parametre. |
static URL |
getURL(String name)
Recherche la ressource nom. |
static URL |
getURLOrNull(String name)
Recherche la ressource nom. |
static List<URL> |
getURLs(String pattern)
Retourner la liste des fichiers du classLoader. |
static List<URL> |
getURLs(String pattern,
URL... arrayURL)
Retourner la liste des fichiers du classLoader. |
static List<URL> |
getURLs(String pattern,
URLClassLoader classLoader)
Retourner la liste des fichiers du classLoader. |
static URL[] |
getURLs(URLClassLoader classLoader)
Deprecated. should use now ClassLoaderUtil.getURLs(URLClassLoader) |
static List<URL> |
getURLsFromDirectory(File repository,
String pattern)
Retourne la liste des fichiers correspondant au pattern donne, aucun ordre ne doit être supposé sur les fichiers. |
static List<URL> |
getURLsFromJar(File jarfile,
String pattern)
|
static List<URL> |
getURLsFromZip(File zipFile,
String pattern)
|
static boolean |
isJar(String name)
Verifie si le fichier est un fichier jar. |
static boolean |
isPrimitive(Class clazz)
Verifie si la classe est de type primitif. |
static boolean |
isZip(String name)
Verifie si le fichier est un fichier zip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected Resource()
| Method Detail |
|---|
public static void addDefaultClassLoader(URL url)
url - l'url a ajouter
public static void addClassLoader(ClassLoader classLoader,
URL url)
classLoader - le classloader a modifierurl - l'url a ajouterpublic static URL getURL(String name)
name - nom de la ressource
ResourceNotFoundException - si la resource n'a pas ete trouveepublic static URL getURLOrNull(String name)
name - le nom de la ressource
public static ImageIcon getIcon(String name)
name - le nom de l'icone
@Deprecated
public static Properties getConfigProperties(String filename)
throws IOException
ApplicationConfig class instead
to ApplicationConfig.setConfigFileName(String)
and search properties file from more folders with
ApplicationConfig.parse(String[]) method
filename - le nom du fichier à rechercher
IOException - si une erreur est survenue
@Deprecated
public static Properties getConfigProperties(String filename,
Properties parent)
throws IOException
ApplicationConfig class instead
to ApplicationConfig.setConfigFileName(String)
and search properties file from more folders with
ApplicationConfig.parse(String[]) method
filename - le nom du fichier à rechercherparent - les proprietes parent a surcharger
IOException - si une erreur est survenuepublic static List<URL> getURLs(String pattern)
pattern - le nom du fichier a extraire du fichier compressé ou
du repertoire doit correspondre au pattern (repertoire + nom
compris).
@Deprecated public static URL[] getURLs(URLClassLoader classLoader)
ClassLoaderUtil.getURLs(URLClassLoader)
URLClassLoader.
Note : Un cas particulier est positionné pour JBoss qui utilise la method getAllURLs.
classLoader - le class loader a scanner
public static List<URL> getURLs(String pattern,
URLClassLoader classLoader)
classLoader - classloader to use (if null, use ClassLoader.getSystemClassLoader()pattern - le nom du fichier a extraire du fichier compressé ou
du repertoire doit correspondre au pattern (repertoire + nom
compris).
public static List<URL> getURLs(String pattern,
URL... arrayURL)
arrayURL - les urls ou chercherpattern - le nom du fichier a extraire du fichier compressé ou
durepertoire doit correspondre au pattern (repertoire + nom
compris).
public static URL[] getClassPathURLsFromJarManifest(URL jarURL)
throws IOException,
URISyntaxException
IOException
URISyntaxException
public static List<URL> getURLsFromZip(File zipFile,
String pattern)
public static List<URL> getURLsFromJar(File jarfile,
String pattern)
public static List<URL> getURLsFromDirectory(File repository,
String pattern)
repository - repertoire dans lequel on recherche les fichierspattern - le nom du fichier a extraire du fichier du repertoire doit
correspondre au pattern (repertoire + nom compris). si le
pattern est null, tous les fichiers trouvé sont retourné.
public static boolean isJar(String name)
name - nom du fichier a tester
public static boolean isZip(String name)
name - nom du fichier a tester
public static boolean isPrimitive(Class clazz)
clazz - nom de la classe a tester
public static Class getPrimitiveClass(Class clazz)
clazz - la classe dont on souhaite le type primitf
public static boolean containsDirectDirectory(URL url,
String directory)
throws IOException
url - the url to seekdirectory - the directory to find
true if directory was found, false otherwise.
IOException - if any io pb
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||