- java.lang.Object
-
- org.arakhne.afc.vmutil.AndroidResourceWrapper
-
- All Implemented Interfaces:
ResourceWrapper
class AndroidResourceWrapper extends Object implements ResourceWrapper
This interface provides the Android implementation to load resources.- Since:
- 7.0
- Version:
- 17.0 2020-01-04 14:41:35
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- vmutils
-
-
Constructor Summary
Constructors Constructor Description AndroidResourceWrapper()
Construct the wrapper.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description URL
getResource(Class<?> clazz, String path)
Replies the URL of a resource.URL
getResource(ClassLoader classLoader, String path)
Deprecated.InputStream
getResourceAsStream(Class<?> clazz, String path)
Replies the input stream of a resource.InputStream
getResourceAsStream(ClassLoader classLoader, String path)
Deprecated.String
translateResourceName(String resourceName)
Translate the given resource name according to the current JVM standard.
-
-
-
Method Detail
-
getResource
@Deprecated(since="17.0") public URL getResource(ClassLoader classLoader, String path)
Deprecated.Description copied from interface:ResourceWrapper
Replies the URL of a resource.You may use Unix-like syntax to write the resource path, ie. you may use slashes to separate filenames.
If the
classLoader
parameter isnull
, the class loader replied byClassLoaderFinder
is used. If this last isnull
, the class loader of the Resources class is used.- Specified by:
getResource
in interfaceResourceWrapper
- Parameters:
classLoader
- is the research scope. Ifnull
, the class loader replied byClassLoaderFinder
is used.path
- is the absolute path of the resource.- Returns:
- the url of the resource or
null
if the resource was not found in class paths.
-
getResource
public URL getResource(Class<?> clazz, String path)
Description copied from interface:ResourceWrapper
Replies the URL of a resource.You may use Unix-like syntax to write the resource path, ie. you may use slashes to separate filenames.
If the
classLoader
parameter isnull
, the class loader replied byClassLoaderFinder
is used. If this last isnull
, the class loader of the Resources class is used.- Specified by:
getResource
in interfaceResourceWrapper
- Parameters:
clazz
- is the research scope. It cannot benull
.path
- is the absolute path of the resource.- Returns:
- the url of the resource or
null
if the resource was not found in class paths.
-
getResourceAsStream
@Deprecated(since="17.0") public InputStream getResourceAsStream(ClassLoader classLoader, String path)
Deprecated.Description copied from interface:ResourceWrapper
Replies the input stream of a resource.You may use Unix-like syntax to write the resource path, ie. you may use slashes to separate filenames, and may not start the path with a slash.
If the
classLoader
parameter isnull
, the class loader replied byClassLoaderFinder
is used. If this last isnull
, the class loader of the Resources class is used.- Specified by:
getResourceAsStream
in interfaceResourceWrapper
- Parameters:
classLoader
- is the research scope. Ifnull
, the class loader replied byClassLoaderFinder
is used.path
- is the absolute path of the resource.- Returns:
- the url of the resource or
null
if the resource was not found in class paths.
-
getResourceAsStream
public InputStream getResourceAsStream(Class<?> clazz, String path)
Description copied from interface:ResourceWrapper
Replies the input stream of a resource.You may use Unix-like syntax to write the resource path, ie. you may use slashes to separate filenames, and may not start the path with a slash.
If the
classLoader
parameter isnull
, the class loader replied byClassLoaderFinder
is used. If this last isnull
, the class loader of the Resources class is used.- Specified by:
getResourceAsStream
in interfaceResourceWrapper
- Parameters:
clazz
- is the research scope. It cannot benull
.path
- is the absolute path of the resource.- Returns:
- the url of the resource or
null
if the resource was not found in class paths.
-
translateResourceName
public String translateResourceName(String resourceName)
Description copied from interface:ResourceWrapper
Translate the given resource name according to the current JVM standard.The
resourceName
argument should be a fully qualified class name. However, for compatibility with earlier versions, Sun's Java SE Runtime Environments do not verify this, and so it is possible to accessPropertyResourceBundle
s by specifying a path name (using "/") instead of a fully qualified class name (using "."). In several VM, such as Dalvik, the translation from "." to "/" is not automatically done by the VM to retreive the file.- Specified by:
translateResourceName
in interfaceResourceWrapper
- Parameters:
resourceName
- the name to translate.- Returns:
- the translated resource name.
-
-