Class DirectoryCodeBase
- java.lang.Object
-
- edu.umd.cs.findbugs.classfile.impl.AbstractScannableCodeBase
-
- edu.umd.cs.findbugs.classfile.impl.DirectoryCodeBase
-
- All Implemented Interfaces:
ICodeBase
,IScannableCodeBase
,java.lang.AutoCloseable
public class DirectoryCodeBase extends AbstractScannableCodeBase
IScannableCodeBase implementation to read resources from a filesystem directory.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
DirectoryCodeBase.DirectoryCodeBaseIterator
-
Nested classes/interfaces inherited from interface edu.umd.cs.findbugs.classfile.ICodeBase
ICodeBase.Discovered
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.File
directory
private RecursiveFileSearch
rfs
private boolean
searchPerformed
-
Constructor Summary
Constructors Constructor Description DirectoryCodeBase(ICodeBaseLocator codeBaseLocator, java.io.File directory)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
This method should be called when done using the code base.(package private) java.io.File
getFullPathOfResource(java.lang.String resourceName)
Get the full path of given resource.java.lang.String
getPathName()
Get the filesystem pathname of this codebase.(package private) java.lang.String
getResourceName(java.lang.String fileName)
Get the resource name given a full filename.ICodeBaseIterator
iterator()
Get an iterator over the resources in the this code base.ICodeBaseEntry
lookupResource(java.lang.String resourceName)
Look up a resource in this code base.(package private) java.io.InputStream
openFile(java.lang.String resourceName)
java.lang.String
toString()
-
Methods inherited from class edu.umd.cs.findbugs.classfile.impl.AbstractScannableCodeBase
addLastModifiedTime, addResourceNameTranslation, containsSourceFiles, getCodeBaseLocator, getHowDiscovered, getLastModifiedTime, isApplicationCodeBase, setApplicationCodeBase, setHowDiscovered, setLastModifiedTime, translateResourceName
-
-
-
-
Field Detail
-
directory
private java.io.File directory
-
rfs
private RecursiveFileSearch rfs
-
searchPerformed
private boolean searchPerformed
-
-
Constructor Detail
-
DirectoryCodeBase
public DirectoryCodeBase(ICodeBaseLocator codeBaseLocator, java.io.File directory)
Constructor.- Parameters:
codeBaseLocator
- the codebase locator for this codebasedirectory
- the filesystem directory
-
-
Method Detail
-
iterator
public ICodeBaseIterator iterator() throws java.lang.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:
java.lang.InterruptedException
-
getPathName
public java.lang.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(java.lang.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
java.io.InputStream openFile(java.lang.String resourceName) throws java.io.IOException
- Throws:
java.io.IOException
-
getFullPathOfResource
java.io.File getFullPathOfResource(java.lang.String resourceName)
Get the full path of given resource.
-
getResourceName
java.lang.String getResourceName(java.lang.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 java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-