public interface FileLocatorAware
Definition of an interface to be implemented by FileBased
objects
which need access to the current FileLocator
.
When loading or saving a FileBased
object using FileHandler
the handler eventually invokes the read()
or write()
methods
passing in a reader or writer. For some implementations this may not be
sufficient because they need information about the current location. For
instance, a concrete FileBased
implementation may have to resolve
other data sources based on relative file names which have to be interpreted
in the context of the current file location.
To deal with such scenarios, affected implementations can choose to implement
this interface. They are then passed the current location to the file being
accessed before their read()
or write()
method is called.
Modifier and Type | Method and Description |
---|---|
void |
initFileLocator(FileLocator locator)
Passes the current
FileLocator to this object. |
void initFileLocator(FileLocator locator)
FileLocator
to this object. Note that this
FileLocator
object is only temporarily valid for the following
invocation of read()
or write(
. Depending on the state of
the FileHandler
and which of its methods was called, the object
may not be fully initialized. For instance, if the FileHandler
's
load(InputStream)
method was called, no file information is
available, and all methods of the FileLocator
will return
null.locator
- the current FileLocator
Copyright © 2001–2020 The Apache Software Foundation. All rights reserved.