public abstract class AbstractFileProvider extends AbstractVfsContainer implements FileProvider
FileProvider
implementation. Takes care of managing the file systems created by the provider.Constructor and Description |
---|
AbstractFileProvider()
Constructs a new instance for subclasses.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addFileSystem(Comparable<?> key,
FileSystem fs)
Adds a file system to those cached by this provider.
|
void |
close()
Closes the file systems created by this provider.
|
void |
closeFileSystem(FileSystem fileSystem)
Closes the FileSystem.
|
FileObject |
createFileSystem(String scheme,
FileObject file,
FileSystemOptions fileSystemOptions)
Creates a layered file system.
|
protected FileSystem |
findFileSystem(Comparable<?> key,
FileSystemOptions fileSystemOptions)
Locates a cached file system.
|
void |
freeUnusedResources()
Frees unused resources.
|
FileSystemConfigBuilder |
getConfigBuilder()
Gets the FileSystemConfigBuilder.
|
protected FileNameParser |
getFileNameParser()
Gets the file name parser.
|
FileName |
parseUri(FileName base,
String uri)
Parses an absolute URI.
|
protected void |
setFileNameParser(FileNameParser parser)
Sets the file name parser.
|
addComponent, removeComponent
getContext, getLogger, init, setContext, setLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
findFile, getCapabilities
public AbstractFileProvider()
protected void addFileSystem(Comparable<?> key, FileSystem fs) throws FileSystemException
The file system may implement VfsComponent
, in which case it is initialized.
key
- The root file of the file system, part of the cache key.fs
- the file system to add.FileSystemException
- if any error occurs.public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in interface VfsComponent
close
in class AbstractVfsContainer
public void closeFileSystem(FileSystem fileSystem)
fileSystem
- The FileSystem to close.public FileObject createFileSystem(String scheme, FileObject file, FileSystemOptions fileSystemOptions) throws FileSystemException
createFileSystem
in interface FileProvider
scheme
- The protocol to use to access the file.file
- a FileObject.fileSystemOptions
- Options to the file system.FileSystemException
- if an error occurs.protected FileSystem findFileSystem(Comparable<?> key, FileSystemOptions fileSystemOptions)
key
- The root file of the file system, part of the cache key.fileSystemOptions
- file system options the file system instance must have, may be null.public void freeUnusedResources()
public FileSystemConfigBuilder getConfigBuilder()
getConfigBuilder
in interface FileProvider
protected FileNameParser getFileNameParser()
public FileName parseUri(FileName base, String uri) throws FileSystemException
parseUri
in interface FileProvider
base
- The base file - if null the uri
needs to be absoluteuri
- The URI to parse.FileSystemException
- if an error occurs.protected void setFileNameParser(FileNameParser parser)
parser
- a file name parser.Copyright © 2002–2025 The Apache Software Foundation. All rights reserved.