org.ujac.util.io
Class FileResourceLoader

java.lang.Object
  extended by org.ujac.util.io.FileResourceLoader
All Implemented Interfaces:
ResourceLoader

public class FileResourceLoader
extends Object
implements ResourceLoader

Title: FileResourceLoader
Description: A resource loader which loads resources from a given directory.

Author:
lauerc

Field Summary
static int IO_BUFFER_SIZE
          The I/O buffer size.
 
Constructor Summary
FileResourceLoader(File rootDirectory)
          Constructs a FileResourceLoader instance with specific attributes.
FileResourceLoader(String rootPath)
          Constructs a FileResourceLoader instance with specific attributes.
 
Method Summary
 byte[] loadResource(String location)
          Loads a binary resource from the file system.
 boolean resourceExists(String location)
          Checks whether or not the desired resource exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IO_BUFFER_SIZE

public static final int IO_BUFFER_SIZE
The I/O buffer size.

See Also:
Constant Field Values
Constructor Detail

FileResourceLoader

public FileResourceLoader(String rootPath)
                   throws IOException
Constructs a FileResourceLoader instance with specific attributes.

Parameters:
rootPath - The root directory location.
Throws:
IOException - If the given rootDirectory does not exist or is no directory.

FileResourceLoader

public FileResourceLoader(File rootDirectory)
                   throws IOException
Constructs a FileResourceLoader instance with specific attributes.

Parameters:
rootDirectory - The root directory.
Throws:
IOException - If the given rootDirectory does not exist or is no directory.
Method Detail

loadResource

public byte[] loadResource(String location)
                    throws IOException
Loads a binary resource from the file system.

Specified by:
loadResource in interface ResourceLoader
Parameters:
location - The location of the resource.
Returns:
The loaded resource.
Throws:
IOException - In case the loading of the resource failed.

resourceExists

public boolean resourceExists(String location)
Checks whether or not the desired resource exists.

Specified by:
resourceExists in interface ResourceLoader
Parameters:
location - The location of the resource.
Returns:
true in case the given resource could be located, else false.


Copyright © 2003-2004 UJAC.org. All Rights Reserved.