Class FilesystemResourceLoader
Simple IResourceLoader that opens resource files from the local file system, optionally resolving against a base directory.
This loader wraps a delegate IResourceLoader that is used to resolve all files, the current base directory does not contain. NewInstance<T>(string) is always resolved against the delegate, as an System.Assembly is needed.
You can chain several FilesystemResourceLoaders to allow lookup of files in more than one base directory.
Implements
Inherited Members
Namespace: Lucene.Net.Analysis.Util
Assembly: Lucene.Net.Analysis.Common.dll
Syntax
public sealed class FilesystemResourceLoader : IResourceLoader
Constructors
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.
Declaration
public FilesystemResourceLoader()
FilesystemResourceLoader(DirectoryInfo)
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.
Declaration
public FilesystemResourceLoader(DirectoryInfo baseDirectory)
Parameters
Type | Name | Description |
---|---|---|
DirectoryInfo | baseDirectory |
FilesystemResourceLoader(DirectoryInfo, IResourceLoader)
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 IResourceLoader.
Declaration
public FilesystemResourceLoader(DirectoryInfo baseDirectory, IResourceLoader @delegate)
Parameters
Type | Name | Description |
---|---|---|
DirectoryInfo | baseDirectory | |
IResourceLoader | delegate |
Methods
FindType(string)
Finds class of the name
NOTE: This was findClass() in LuceneDeclaration
public Type FindType(string cname)
Parameters
Type | Name | Description |
---|---|---|
string | cname |
Returns
Type | Description |
---|---|
Type |
NewInstance<T>(string)
Creates an instance of the name and expected type
Declaration
public T NewInstance<T>(string cname)
Parameters
Type | Name | Description |
---|---|---|
string | cname |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
OpenResource(string)
Opens a named resource
Declaration
public Stream OpenResource(string resource)
Parameters
Type | Name | Description |
---|---|---|
string | resource |
Returns
Type | Description |
---|---|
Stream |