Class AbstractFileProvider

All Implemented Interfaces:
Closeable, AutoCloseable, FileProvider, VfsComponent
Direct Known Subclasses:
AbstractLayeredFileProvider, AbstractOriginatingFileProvider, CompositeFileProvider, ResourceFileProvider, TemporaryFileProvider, UrlFileProvider

public abstract class AbstractFileProvider extends AbstractVfsContainer implements FileProvider
A partial FileProvider implementation. Takes care of managing the file systems created by the provider.
  • Field Details

  • Constructor Details

    • AbstractFileProvider

      public AbstractFileProvider()
  • Method Details

    • getFileNameParser

      protected FileNameParser getFileNameParser()
    • setFileNameParser

      protected void setFileNameParser(FileNameParser parser)
    • close

      public void close()
      Closes the file systems created by this provider.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface VfsComponent
      Overrides:
      close in class AbstractVfsContainer
    • createFileSystem

      public FileObject createFileSystem(String scheme, FileObject file, FileSystemOptions fileSystemOptions) throws FileSystemException
      Creates a layered file system. This method throws a 'not supported' exception.
      Specified by:
      createFileSystem in interface FileProvider
      Parameters:
      scheme - The protocol to use to access the file.
      file - a FileObject.
      fileSystemOptions - Options to the file system.
      Returns:
      A FileObject associated with the new FileSystem.
      Throws:
      FileSystemException - if an error occurs.
    • addFileSystem

      protected void addFileSystem(Comparable<?> key, FileSystem fs) throws FileSystemException
      Adds a file system to those cached by this provider.

      The file system may implement VfsComponent, in which case it is initialized.

      Parameters:
      key - The root file of the file system, part of the cache key.
      fs - the file system to add.
      Throws:
      FileSystemException - if any error occurs.
    • findFileSystem

      protected FileSystem findFileSystem(Comparable<?> key, FileSystemOptions fileSystemOptions)
      Locates a cached file system.
      Parameters:
      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.
      Returns:
      The file system instance, or null if it is not cached.
    • getConfigBuilder

      public FileSystemConfigBuilder getConfigBuilder()
      Returns the FileSystemConfigBuidler.
      Specified by:
      getConfigBuilder in interface FileProvider
      Returns:
      the FileSystemConfigBuilder.
    • freeUnusedResources

      public void freeUnusedResources()
      Free unused resources.
    • closeFileSystem

      public void closeFileSystem(FileSystem fileSystem)
      Close the FileSystem.
      Parameters:
      fileSystem - The FileSystem to close.
    • parseUri

      public FileName parseUri(FileName base, String uri) throws FileSystemException
      Parses an absolute URI.
      Specified by:
      parseUri in interface FileProvider
      Parameters:
      base - The base file - if null the uri needs to be absolute
      uri - The URI to parse.
      Returns:
      The FileName.
      Throws:
      FileSystemException - if an error occurs.