public final class FileLocator extends Object
A class describing the location of a file.
An instance of this class provides information for locating and accessing a file. The file location can be defined
In addition, other properties are available which are also needed for loading or saving a file, like the underlying
FileSystem
. The encoding to be used when accessing the represented data is also part of the data contained in
an instance; if no encoding is set explicitly, the platform's default encoding is used.
Instances of this class are immutable and thus can be safely shared between arbitrary components. FileHandler
also uses an instance to reference the associated file. Instances are created using a builder.
FileLocatorUtils
offers convenience methods for obtaining such a builder.
Modifier and Type | Class and Description |
---|---|
static class |
FileLocator.FileLocatorBuilder
A typical builder implementation for creating
FileLocator objects. |
Constructor and Description |
---|
FileLocator(FileLocator.FileLocatorBuilder builder)
Creates a new instance of
FileLocatorImpl and initializes it from the given builder instance |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Compares this object with another one.
|
String |
getBasePath()
Returns the base path stored in this locator or null if it is undefined.
|
String |
getEncoding()
Returns the encoding stored in this locator or null if it is undefined.
|
String |
getFileName()
Returns the file name stored in this locator or null if it is undefined.
|
FileSystem |
getFileSystem()
Returns the
FileSystem to be used for accessing the file referenced by this locator or null if it is
undefined. |
FileLocationStrategy |
getLocationStrategy()
Returns the
FileLocationStrategy to be used for locating the referenced file. |
URL |
getSourceURL()
Returns the URL pointing to the referenced source file or null if it is undefined.
|
URLConnectionOptions |
getURLConnectionOptions()
Returns the URLConnectionOptions
|
int |
hashCode()
Returns a hash code for this object.
|
String |
toString() |
public FileLocator(FileLocator.FileLocatorBuilder builder)
FileLocatorImpl
and initializes it from the given builder instancebuilder
- the builderpublic boolean equals(Object obj)
FileLocatorImpl
are considered equal if all of their
properties are equal.public String getBasePath()
public String getEncoding()
public String getFileName()
public FileSystem getFileSystem()
FileSystem
to be used for accessing the file referenced by this locator or null if it is
undefined.FileSystem
public FileLocationStrategy getLocationStrategy()
FileLocationStrategy
to be used for locating the referenced file. If no specific
FileLocationStrategy
has been set, result is null. This means that the default strategy should be
used.FileLocationStrategy
to be usedpublic URL getSourceURL()
public URLConnectionOptions getURLConnectionOptions()
public int hashCode()
Copyright © 2001–2022 The Apache Software Foundation. All rights reserved.