org.xith3d.resources
Class ResLoc

java.lang.Object
  extended by org.xith3d.resources.ResLoc

public class ResLoc
extends java.lang.Object

This is a "shortcut" for the singleton instance of ResourceLocator.

See Also:
ResourceLocator, ResourceLocator.setSingletonInstance(ResourceLocator), ResourceLocator.getInstance()

Constructor Summary
ResLoc()
           
 
Method Summary
static org.jagatoo.loaders.textures.locators.TextureStreamLocator createAndAddTSL()
          Creates a TextureStreamLocator and adds it to the TextureLoader.
static org.jagatoo.loaders.textures.locators.TextureStreamLocator createAndAddTSL(java.lang.String resourceName)
          Creates a TextureStreamLocator and adds it to the TextureLoader.
static java.util.List<java.net.URL> findAllResources(java.lang.String extension, boolean recursively, boolean foldersToo)
          Searches for all child resources in the current singleton ResourceLoator instance.
static java.net.URL getBaseURL()
           
static java.net.URL getResource(java.lang.String name)
          Creates a resource as a URL from this ResourceLocator.
static java.io.InputStream getResourceAsStream(java.lang.String name)
          Creates a resource as a URL from this ResourceLocator.
static org.jagatoo.loaders.textures.locators.TextureStreamLocatorURL getTSL()
          Creates a TextureStreamLocator to be added to the TextureLoader.
static org.jagatoo.loaders.textures.locators.TextureStreamLocatorURL getTSL(java.lang.String resourceName)
          Creates a TextureStreamLocator to be added to the TextureLoader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResLoc

public ResLoc()
Method Detail

getBaseURL

public static java.net.URL getBaseURL()
Returns:
the base-URL of this ResourceLocator

getResource

public static java.net.URL getResource(java.lang.String name)
                                throws java.net.MalformedURLException
Creates a resource as a URL from this ResourceLocator. The given resource-name must be relative to this instance's baseURL.

Parameters:
name - the relative resource to complete with this instance's baseURL to an absolute one
Returns:
the resource
Throws:
java.net.MalformedURLException - if something was wrong with the resource

getResourceAsStream

public static java.io.InputStream getResourceAsStream(java.lang.String name)
                                               throws java.net.MalformedURLException,
                                                      java.io.IOException
Creates a resource as a URL from this ResourceLocator. The given resource-name must be relative to this instance's baseURL.

Parameters:
name - the relative resource to complete with this instance's baseURL to an absolute one
Returns:
an InputStream from the resource
Throws:
java.net.MalformedURLException - if something was wrong with the resource
java.io.IOException - when the InputStream could not be created

findAllResources

public static java.util.List<java.net.URL> findAllResources(java.lang.String extension,
                                                            boolean recursively,
                                                            boolean foldersToo)
Searches for all child resources in the current singleton ResourceLoator instance.

Parameters:
extension -
recursively -
foldersToo -
Returns:
a List of all found resources

getTSL

public static org.jagatoo.loaders.textures.locators.TextureStreamLocatorURL getTSL(java.lang.String resourceName)
                                                                            throws java.net.MalformedURLException
Creates a TextureStreamLocator to be added to the TextureLoader.

Parameters:
resourceName - the relative resource to complete with this instance's baseURL to an absolute one It is taken as the constructor's argument for the TextureStreamLocatorURL.
Returns:
the created TextureStreamLocatorURL to be added to the TextureLoader
Throws:
java.net.MalformedURLException - if something was wrong with the resource

getTSL

public static org.jagatoo.loaders.textures.locators.TextureStreamLocatorURL getTSL()
Creates a TextureStreamLocator to be added to the TextureLoader. The result of getBaseURL() is taken as the constructor's argument for the TextureStreamLocatorURL.

Returns:
the created TextureStreamLocatorURL to be added to the TextureLoader

createAndAddTSL

public static org.jagatoo.loaders.textures.locators.TextureStreamLocator createAndAddTSL(java.lang.String resourceName)
                                                                                  throws java.net.MalformedURLException
Creates a TextureStreamLocator and adds it to the TextureLoader.

Parameters:
resourceName - the relative resource to complete with this instance's baseURL to an absolute one It is taken as the constructor's argument for the TextureStreamLocatorURL.
Throws:
java.net.MalformedURLException - if something was wrong with the resource

createAndAddTSL

public static org.jagatoo.loaders.textures.locators.TextureStreamLocator createAndAddTSL()
Creates a TextureStreamLocator and adds it to the TextureLoader. The result of getBaseURL() is taken as the constructor's argument for the TextureStreamLocatorURL.