edu.umd.cs.findbugs.ba
Class SourceFinder

java.lang.Object
  extended by edu.umd.cs.findbugs.ba.SourceFinder

public class SourceFinder
extends java.lang.Object

Class to open input streams on source files. It maintains a "source path", which is like a classpath, but for finding source files instead of class files.


Nested Class Summary
private static class SourceFinder.Cache
          Cache of SourceFiles.
private static class SourceFinder.DirectorySourceRepository
          A directory containing source files.
private static interface SourceFinder.SourceRepository
          A repository of source files.
private static class SourceFinder.ZipSourceRepository
          A zip or jar archive containing source files.
 
Field Summary
private  SourceFinder.Cache cache
           
private static int CACHE_SIZE
           
private static boolean DEBUG
           
private  java.util.List<SourceFinder.SourceRepository> repositoryList
           
 
Constructor Summary
SourceFinder()
          Constructor.
 
Method Summary
 SourceFile findSourceFile(java.lang.String packageName, java.lang.String fileName)
          Open a source file in given package.
 java.io.InputStream openSource(java.lang.String packageName, java.lang.String fileName)
          Open an input stream on a source file in given package.
 void setSourceBaseList(java.util.List<java.lang.String> sourceBaseList)
          Set the list of source directories.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG

CACHE_SIZE

private static final int CACHE_SIZE
See Also:
Constant Field Values

repositoryList

private java.util.List<SourceFinder.SourceRepository> repositoryList

cache

private SourceFinder.Cache cache
Constructor Detail

SourceFinder

public SourceFinder()
Constructor.

Method Detail

setSourceBaseList

public void setSourceBaseList(java.util.List<java.lang.String> sourceBaseList)
Set the list of source directories.


openSource

public java.io.InputStream openSource(java.lang.String packageName,
                                      java.lang.String fileName)
                               throws java.io.IOException
Open an input stream on a source file in given package.

Parameters:
packageName - the name of the package containing the class whose source file is given
fileName - the unqualified name of the source file
Returns:
an InputStream on the source file
Throws:
java.io.IOException - if a matching source file cannot be found

findSourceFile

public SourceFile findSourceFile(java.lang.String packageName,
                                 java.lang.String fileName)
                          throws java.io.IOException
Open a source file in given package.

Parameters:
packageName - the name of the package containing the class whose source file is given
fileName - the unqualified name of the source file
Returns:
the source file
Throws:
java.io.IOException - if a matching source file cannot be found