public interface FileLocationStrategy
An interface allowing applications to customize the process of locating a file.
FileLocator objects for referencing files.
These objects are not guaranteed to identify a file in a unique way. For
instance, if only a file name is defined, this could mean a relative file
name in the current directory, the name of a resource to be loaded from the
class path, or something else. Before the file described by a
FileLocator can be actually accessed, an unambiguous URL pointing to
this file has to be obtained. This is the job of a
This interface defines a method for locating a file provided as a
FileLocator object. If location is successful, a URL is returned. A
concrete implementation can perform arbitrary actions to search for the file
in question at various places. There will also be an implementation allowing
the combination of multiple
FileLocationStrategy implementations; so
a file can be searched using multiple strategies until one of them is
URL locate(FileSystem fileSystem, FileLocator locator)
FileSystemto be used. Note that the
FileLocatorobject may also contain a
FileSystem, but this is optional. The passed in
FileSystemshould be used, and callers must not pass a null reference for this argument. A concrete implementation has to evaluate the properties stored in the
FileLocatorobject and try to match them to an existing file. If this can be done, a corresponding URL is returned. Otherwise, result is null. Implementations should not throw an exception (unless parameters are null) as there might be alternative strategies which can find the file in question.
FileSystemto be used for this operation
locator- the object describing the file to be located
Copyright © 2001–2017 The Apache Software Foundation. All rights reserved.