[Arakhnę-Dev] [108] FileSystem may use Resources to retreive java resources. |
[ Thread Index |
Date Index
| More arakhne.org/dev Archives
]
Revision: 108
Author: galland
Date: 2010-01-02 11:12:32 +0100 (Sat, 02 Jan 2010)
Log Message:
-----------
FileSystem may use Resources to retreive java resources.
Modified Paths:
--------------
trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/FileSystem.java
Modified: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/FileSystem.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/FileSystem.java 2009-12-23 23:16:09 UTC (rev 107)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/FileSystem.java 2010-01-02 10:12:32 UTC (rev 108)
@@ -1274,20 +1274,21 @@
* <li>try to build an {@link URL} with <var>urlDescription</var> as parameter;</li>
* <li>if <var>allowResourceSearch</var> is <code>true</code> and
* <var>urlDescription</var> starts with {@code "resource:"}, call
- * {@link Class#getResource(String)} with the rest of the string as parameter;</li>
+ * {@link Resources#getResource(String)} with the rest of the string as parameter;</li>
* <li>if <var>allowResourceSearch</var> is <code>true</code>, call
- * {@link Class#getResource(String)} with the <var>urlDescription</var> as
+ * {@link Resources#getResource(String)} with the <var>urlDescription</var> as
* parameter;</li>
* <li>assuming that the <var>urlDescription</var> is
* a filename, call {@link File#toURI()} to retreive an URI and then
* {@link URI#toURL()};</li>
- * <li>If every thing else failed, return <code>null</code>.</li>
+ * <li>If everything else failed, return <code>null</code>.</li>
* </ul>
*
* @param urlDescription is a string which is describing an URL.
- * @param allowResourceSearch indicates if the convertion must take into account the resources.
+ * @param allowResourceSearch indicates if the convertion must take into account the Java resources.
* @return the URL.
* @throws IllegalArgumentException is the string could not be formatted to URL.
+ * @see Resources#getResource(String)
*/
public static URL convertStringToUrl(String urlDescription, boolean allowResourceSearch) {
if (urlDescription==null || urlDescription.length()==0) return null;
@@ -1307,13 +1308,11 @@
if (urlDescription.toLowerCase().startsWith("resource:")) { //$NON-NLS-1$
resourceName = urlDescription.substring(9);
- if (resourceName.startsWith(URL_PATH_SEPARATOR)) resourceName = resourceName.substring(1);
- return ClassLoader.getSystemResource(resourceName);
+ return Resources.getResource(resourceName);
}
resourceName = urlDescription;
- if (resourceName.startsWith(URL_PATH_SEPARATOR)) resourceName = resourceName.substring(1);
- url = ClassLoader.getSystemResource(resourceName);
+ url = Resources.getResource(resourceName);
if (url!=null) return url;
}
else if (urlDescription.toLowerCase().startsWith("resource:")) { //$NON-NLS-1$