org.wegra.util.resource
Class FileResourceLoader

java.lang.Object
  extended byorg.wegra.util.resource.FileResourceLoader
All Implemented Interfaces:
ResourceLoader

public class FileResourceLoader
extends java.lang.Object
implements ResourceLoader

ResourceLoader class specified file resource.

Version:
1.0, 07/04/2002
Author:
wegra (Bok-Youn Lee)

Constructor Summary
FileResourceLoader()
           
 
Method Summary
 java.io.ByteArrayInputStream getResource(java.io.File file)
          Loads specified file resource.
 java.lang.Object getResource(java.lang.Object key)
          Loads specified file resource.
 java.lang.Object getResource(java.lang.String location)
          Loads specified file resource.
 java.io.ByteArrayInputStream[] getResources(java.io.File directory)
          Loads all file resources from specified directory.
 java.lang.Object[] getResources(java.lang.Object baseKey)
          Loads specified file resource.
 java.lang.Object[] getResources(java.lang.String baseLocation)
          Loads all file resources from specified directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileResourceLoader

public FileResourceLoader()
Method Detail

getResource

public java.lang.Object getResource(java.lang.Object key)
                             throws ResourceLoaderException
Loads specified file resource. Please rememver the maximum acceptable file length is Integer.MAX_VALUE (about 2Giga bytes). It will throw ResourceLoaderException if key's type is not String or File.

Specified by:
getResource in interface ResourceLoader
Parameters:
key - file location.
Returns:
file's content (as byte array)
Throws:
ResourceLoaderException - if key's type is not String or File.
See Also:
ResourceLoader.getResource(String)

getResource

public java.lang.Object getResource(java.lang.String location)
                             throws ResourceLoaderException
Loads specified file resource. Please rememver the maximum acceptable file length is Integer.MAX_VALUE (about 2Giga bytes).

Specified by:
getResource in interface ResourceLoader
Parameters:
location - file location.
Returns:
file's content (as byte array)
Throws:
ResourceLoaderException
See Also:
ResourceLoader.getResource(String), getResource(File)

getResource

public java.io.ByteArrayInputStream getResource(java.io.File file)
                                         throws ResourceLoaderException
Loads specified file resource. Please rememver the maximum acceptable file length is Integer.MAX_VALUE (about 2Giga bytes).

Parameters:
file - specified file
Returns:
file's content as byte[]
Throws:
ResourceLoaderException

getResources

public java.lang.Object[] getResources(java.lang.Object baseKey)
                                throws ResourceLoaderException
Loads specified file resource. Please rememver the maximum acceptable file length is Integer.MAX_VALUE (about 2Giga bytes). It will throw ResourceLoaderException if key's type is not String or File.

Specified by:
getResources in interface ResourceLoader
Parameters:
baseKey - file location.
Returns:
file's content (as byte array)
Throws:
ResourceLoaderException - if key's type is not String or File.

getResources

public java.lang.Object[] getResources(java.lang.String baseLocation)
                                throws ResourceLoaderException
Loads all file resources from specified directory. Specified directory is locked while loading. Please rememver the maximum acceptable file length is Integer.MAX_VALUE (about 2Giga bytes).

Specified by:
getResources in interface ResourceLoader
Parameters:
baseLocation - specified directory.
Returns:
all file's content of specified directory as byte[][].
Throws:
ResourceLoaderException

getResources

public java.io.ByteArrayInputStream[] getResources(java.io.File directory)
                                            throws ResourceLoaderException
Loads all file resources from specified directory. Specified directory is locked while loading. Please rememver the maximum acceptable file length is Integer.MAX_VALUE (about 2Giga bytes).

Parameters:
directory - specified directory.
Returns:
all file's content of specified directory as byte[][].
Throws:
ResourceLoaderException