Package org.apache.commons.configuration2.io

# Interface FileLocatorAware

All Known Implementing Classes:
  `PropertiesConfiguration`, `XMLConfiguration`, `XMLPropertiesConfiguration`, `XMLPropertyListConfiguration`

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.

Since:
  2.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `initFileLocator(FileLocator locator)`
  Passes the current `FileLocator` to this object.

- ## Method Details

  - ### initFileLocator

    void initFileLocator(FileLocator locator)
    Passes the current `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.
    Parameters:
      `locator` - the current `FileLocator`