Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.analysis.util
Class FilesystemResourceLoader

    java.lang.Object
      org.apache.lucene.analysis.util.FilesystemResourceLoader

All Implemented Interfaces:
  ResourceLoader

    public final class FilesystemResourceLoader

extends Object
implements ResourceLoader

Simple `ResourceLoader` that opens resource files from the local file system, optionally resolving against a base directory.

This loader wraps a delegate `ResourceLoader` that is used to resolve all files, the current base directory does not contain. `newInstance(java.lang.String, java.lang.Class)` is always resolved against the delegate, as a `ClassLoader` is needed.

You can chain several `FilesystemResourceLoader`s to allow lookup of files in more than one base directory.

Constructor Summary
`FilesystemResourceLoader()` Creates a resource loader that requires absolute filenames or relative to CWD to resolve resources.
`FilesystemResourceLoader(File baseDirectory)` Creates a resource loader that resolves resources against the given base directory (may be `null` to refer to CWD).
`FilesystemResourceLoader(File baseDirectory, ResourceLoader delegate)` Creates a resource loader that resolves resources against the given base directory (may be `null` to refer to CWD).

Method Summary
`
`<T> Class<? extends T>`
` | `findClass(String cname, Class<T> expectedType)` Finds class of the name and expected type
`
`<T> T`
` | `newInstance(String cname, Class<T> expectedType)` Creates an instance of the name and expected type
`InputStream` | `openResource(String resource)` Opens a named resource

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### FilesystemResourceLoader

    public FilesystemResourceLoader()

  Creates a resource loader that requires absolute filenames or relative to CWD to resolve resources. Files not found in file system and class lookups are delegated to context classloader.

### FilesystemResourceLoader

    public FilesystemResourceLoader(File baseDirectory)

  Creates a resource loader that resolves resources against the given base directory (may be `null` to refer to CWD). Files not found in file system and class lookups are delegated to context classloader.

### FilesystemResourceLoader

    public FilesystemResourceLoader(File baseDirectory,
                                    ResourceLoader delegate)

  Creates a resource loader that resolves resources against the given base directory (may be `null` to refer to CWD). Files not found in file system and class lookups are delegated to the given delegate `ResourceLoader`.

Method Detail

### openResource

    public InputStream openResource(String resource)
                             throws IOException

  Description copied from interface: `ResourceLoader`
  Opens a named resource

  Specified by:
    `openResource` in interface `ResourceLoader`
  Throws:
    `IOException`

### newInstance

    public <T> T newInstance(String cname,
                             Class<T> expectedType)

  Description copied from interface: `ResourceLoader`
  Creates an instance of the name and expected type

  Specified by:
    `newInstance` in interface `ResourceLoader`

### findClass

    public <T> Class<? extends T> findClass(String cname,
                                            Class<T> expectedType)

  Description copied from interface: `ResourceLoader`
  Finds class of the name and expected type

  Specified by:
    `findClass` in interface `ResourceLoader`

Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.