com.tirix.anim8or
Class DefaultResourceLoader

java.lang.Object
  extended by com.tirix.anim8or.DefaultResourceLoader
All Implemented Interfaces:
Anim8orLoader.ResourceLoader

public class DefaultResourceLoader
extends Object
implements Anim8orLoader.ResourceLoader

A facility for loading resources. This default ResourceLoader implementation simply tries to access the resources as files. This is sufficient in most cases. More advanced implementations may include: - looking for images/textures in a special directory, - getting the resources from a jar or a ZIP file, - getting the resources from the Applet resources, - etc.

Version:
$Id: DefaultResourceLoader.java,v 1.1 2008/02/02 23:54:25 tirix Exp $

Change Log:
 $Log: DefaultResourceLoader.java,v $
 Revision 1.1  2008/02/02 23:54:25  tirix
 Added a 'ResourceLoader' interface: enables to customize eg. texture loading.


 
Copyright (C) 2008 Thierry Arnoux.

Author:
Thierry Arnoux

Constructor Summary
DefaultResourceLoader(LoaderBase loaderBase)
           
 
Method Summary
 File getFile(String resourceName)
           
 Image openImage(String resourceName)
          Opens the image using the resource loader specific method.
 InputStream openResource(String resourceName)
          Opens the resource using the resource loader specific method.
 InputStream openResource(URL url)
          Opens the URL using the resource loader specific method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultResourceLoader

public DefaultResourceLoader(LoaderBase loaderBase)
Method Detail

getFile

public File getFile(String resourceName)
             throws IOException
Throws:
IOException

openResource

public InputStream openResource(String resourceName)
                         throws IOException
Description copied from interface: Anim8orLoader.ResourceLoader
Opens the resource using the resource loader specific method.

Specified by:
openResource in interface Anim8orLoader.ResourceLoader
Parameters:
resourceName - the name of the resource to be opened
Returns:
the resource contents as an InputStream
Throws:
IOException - if the resource cannot be accessed

openImage

public Image openImage(String resourceName)
                throws IOException
Description copied from interface: Anim8orLoader.ResourceLoader
Opens the image using the resource loader specific method.

Specified by:
openImage in interface Anim8orLoader.ResourceLoader
Parameters:
resourceName - the name of the image resource to be opened
Returns:
the resource contents as an Image object
Throws:
IOException - if the image resource cannot be accessed

openResource

public InputStream openResource(URL url)
                         throws IOException
Description copied from interface: Anim8orLoader.ResourceLoader
Opens the URL using the resource loader specific method.

Specified by:
openResource in interface Anim8orLoader.ResourceLoader
Parameters:
url - the URL of the resource to open.
Returns:
the resource contents as an InputStream
Throws:
IOException - if the resource cannot be accessed