org.jacoco.report
Class DirectorySourceFileLocator

java.lang.Object
  extended by org.jacoco.report.DirectorySourceFileLocator
All Implemented Interfaces:
ISourceFileLocator

public class DirectorySourceFileLocator
extends Object
implements ISourceFileLocator

Locator for source files that picks source files from a given directory in the file system.

Version:
$Revision: $
Author:
Marc R. Hoffmann

Constructor Summary
DirectorySourceFileLocator(File directory, String encoding)
          Creates a new locator that searches for source files in the given directory.
 
Method Summary
 Reader getSourceFile(String packageName, String fileName)
          Tries to locate the given source file and opens a reader with the appropriate encoding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectorySourceFileLocator

public DirectorySourceFileLocator(File directory,
                                  String encoding)
Creates a new locator that searches for source files in the given directory.

Parameters:
directory - directory to search for source file
encoding - encoding of the source files
Method Detail

getSourceFile

public Reader getSourceFile(String packageName,
                            String fileName)
                     throws IOException
Description copied from interface: ISourceFileLocator
Tries to locate the given source file and opens a reader with the appropriate encoding.

Specified by:
getSourceFile in interface ISourceFileLocator
Parameters:
packageName - VM name of the package
fileName - name of the source file
Returns:
reader if the file could be located, null otherwise
Throws:
IOException - in case of problems while opening the file