Class UrlLocator

java.lang.Object
com.jme3.asset.plugins.UrlLocator
All Implemented Interfaces:
AssetLocator

public class UrlLocator extends Object implements AssetLocator
UrlLocator is a locator that combines a root URL and the given path in the AssetKey to construct a new URL that allows locating the asset.

The root path must be a valid URL, for example,
https://www.example.com/assets/

  • Constructor Details

    • UrlLocator

      public UrlLocator()
  • Method Details

    • setRootPath

      public void setRootPath(String rootPath)
      Specified by:
      setRootPath in interface AssetLocator
      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

      public AssetInfo locate(AssetManager manager, AssetKey key)
      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. The AssetInfo implementation provided should have a proper return value for its AssetInfo.openStream() method.
      Specified by:
      locate in interface AssetLocator
      Parameters:
      manager - for managing assets
      key - identifies the asset to be located
      Returns:
      The AssetInfo that was located, or null if not found.