Class DirectoryCodeBase

java.lang.Object
edu.umd.cs.findbugs.classfile.impl.AbstractScannableCodeBase
edu.umd.cs.findbugs.classfile.impl.DirectoryCodeBase
All Implemented Interfaces:
ICodeBase, IScannableCodeBase, AutoCloseable

public class DirectoryCodeBase extends AbstractScannableCodeBase
IScannableCodeBase implementation to read resources from a filesystem directory.
  • Field Details

    • directory

      private File directory
    • rfs

      private RecursiveFileSearch rfs
    • searchPerformed

      private boolean searchPerformed
  • Constructor Details

    • DirectoryCodeBase

      public DirectoryCodeBase(ICodeBaseLocator codeBaseLocator, File directory)
      Constructor.
      Parameters:
      codeBaseLocator - the codebase locator for this codebase
      directory - the filesystem directory
  • Method Details

    • iterator

      public ICodeBaseIterator iterator() throws InterruptedException
      Description copied from interface: IScannableCodeBase
      Get an iterator over the resources in the this code base.
      Returns:
      ICodeBaseIterator over the resources in the code base
      Throws:
      InterruptedException
    • getPathName

      public String getPathName()
      Description copied from interface: ICodeBase
      Get the filesystem pathname of this codebase.
      Returns:
      the filesystem pathname of this codebase, or null if this codebase is not accessible via the filesystem
    • close

      public void close()
      Description copied from interface: ICodeBase
      This method should be called when done using the code base.
    • lookupResource

      public ICodeBaseEntry lookupResource(String resourceName)
      Description copied from interface: ICodeBase
      Look up a resource in this code base.
      Parameters:
      resourceName - name of the resource to look up
      Returns:
      ICodeBaseEntry representing the resource or null if the resource cannot be found in this code base
    • openFile

      InputStream openFile(String resourceName) throws FileNotFoundException, IOException
      Throws:
      FileNotFoundException
      IOException
    • getFullPathOfResource

      File getFullPathOfResource(String resourceName)
      Get the full path of given resource.
    • getResourceName

      String getResourceName(String fileName)
      Get the resource name given a full filename.
      Parameters:
      fileName - the full filename (which must be inside the directory)
      Returns:
      the resource name (i.e., the filename with the directory stripped off)
    • toString

      public String toString()
      Overrides:
      toString in class Object