Class FileResourceLoader

All Implemented Interfaces:
AutoCloseable, IterableResourceLoader, ResourceLoader

final class FileResourceLoader extends NativeLibraryResourceLoader implements IterableResourceLoader
  • Field Details

  • Constructor Details

  • Method Details

    • readManifestFile

      private static Manifest readManifestFile(File manifestFile)
    • getRootName

      public String getRootName()
      Description copied from interface: ResourceLoader
      Get the name of the root represented by this resource loader.
      Specified by:
      getRootName in interface ResourceLoader
      Overrides:
      getRootName in class AbstractResourceLoader
      Returns:
      the name of the root
    • getClassSpec

      public ClassSpec getClassSpec(String fileName) throws IOException
      Description copied from interface: ResourceLoader
      Get the class specification for the given class name. If no matching class is found, null is returned.
      Specified by:
      getClassSpec in interface ResourceLoader
      Overrides:
      getClassSpec in class AbstractResourceLoader
      Parameters:
      fileName - the fileName of the class, e.g. for the class org.jboss.modules.ResourceLoader the fileName will be org/jboss/modules/ResourceLoader.class
      Returns:
      the class specification, or null if the named class is not found
      Throws:
      IOException - if an I/O error occurs
    • doGetClassSpec

      private ClassSpec doGetClassSpec(String fileName) throws IOException
      Throws:
      IOException
    • getPackageSpec

      public PackageSpec getPackageSpec(String name) throws IOException
      Description copied from interface: ResourceLoader
      Get the package specification for the given directory name. Always returns a package specification; this method cannot be used to test for the existence of a package. A package spec should always be acquired from the same resource loader which provided the class specification. The directory name will always be specified using "/" separators.
      Specified by:
      getPackageSpec in interface ResourceLoader
      Overrides:
      getPackageSpec in class AbstractResourceLoader
      Parameters:
      name - the directory name
      Returns:
      the package specification
      Throws:
      IOException - if an I/O error occurs
    • getResource

      public Resource getResource(String name)
      Description copied from interface: ResourceLoader
      Get a resource with the given name. If no such resource is available, null is returned. The resource name will always be specified using "/" separators for the directory segments.
      Specified by:
      getResource in interface ResourceLoader
      Overrides:
      getResource in class AbstractResourceLoader
      Parameters:
      name - the resource name
      Returns:
      the resource, or null if it is not available
    • iterateResources

      public Iterator<Resource> iterateResources(String startPath, boolean recursive)
      Description copied from interface: IterableResourceLoader
      Enumerate all the resources under the given path. The given path name is relative to the root of the resource loader. If the path "escapes" the root via .., such segments will be consumed. If the path is absolute, it will be converted to a relative path by dropping the leading /.
      Specified by:
      iterateResources in interface IterableResourceLoader
      Parameters:
      startPath - the path to search under
      recursive - true to recursively descend into subdirectories, false to only read this path
      Returns:
      the resource iterator (possibly empty)
    • getPaths

      public Collection<String> getPaths()
      Description copied from interface: ResourceLoader
      Get the collection of resource paths. Called one time only when the resource loader is initialized. The paths should use "/" characters to separate the path segments.
      Specified by:
      getPaths in interface ResourceLoader
      Overrides:
      getPaths in class AbstractResourceLoader
      Returns:
      the resource paths
    • getLocation

      public URI getLocation()
      Description copied from interface: ResourceLoader
      Get the base location of the resources in this loader (if any). If the location is not known, or the resource loader does not support locations, or the resource loader does not support this method, null is returned.
      Specified by:
      getLocation in interface ResourceLoader
      Overrides:
      getLocation in class NativeLibraryResourceLoader
      Returns:
      the base location of the resources in this loader, or null if not available
    • buildIndex

      private void buildIndex(List<String> index, File root, String pathBase)