Package com.jme3.asset.plugins
Class ClasspathLocator
java.lang.Object
com.jme3.asset.plugins.ClasspathLocator
- All Implemented Interfaces:
AssetLocator
The
ClasspathLocator
looks up an asset in the classpath.
This locator is used by default in all jME3 projects (unless
unregistered
).
Unlike Java's default resource loading mechanism, the ClasspathLocator
enforces case-sensitivity on platforms which do not have it such as Windows.
Therefore, it is critical to provide a path matching the case of the file on
the filesystem. This also ensures that the file can be loaded if it was
later included in a .JAR
file instead of a folder.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlocate
(AssetManager manager, AssetKey key) Request to locate an asset.void
setRootPath
(String rootPath)
-
Constructor Details
-
ClasspathLocator
public ClasspathLocator()
-
-
Method Details
-
setRootPath
- Specified by:
setRootPath
in interfaceAssetLocator
- Parameters:
rootPath
- The root path where to look for assets. Typically, this method will only be called once for each instance of an asset locator.
-
locate
Description copied from interface:AssetLocator
Request to locate an asset. The asset key contains a name identifying the asset. If an asset was not found, null should be returned. TheAssetInfo
implementation provided should have a proper return value for itsAssetInfo.openStream()
method.- Specified by:
locate
in interfaceAssetLocator
- Parameters:
manager
- for managing assetskey
- identifies the asset to be located- Returns:
- The
AssetInfo
that was located, or null if not found.
-