Package org.jacoco.report
Class MultiSourceFileLocator
- java.lang.Object
-
- org.jacoco.report.MultiSourceFileLocator
-
- All Implemented Interfaces:
ISourceFileLocator
public class MultiSourceFileLocator extends java.lang.Object implements ISourceFileLocator
Locator that searches source files in multipleISourceFileLocatorinstances. For each lookup request the first locator that returns aReaderfor source content is selected.
-
-
Constructor Summary
Constructors Constructor Description MultiSourceFileLocator(int tabWidth)Creates a new empty locator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(ISourceFileLocator locator)Adds the given locator.java.io.ReadergetSourceFile(java.lang.String packageName, java.lang.String fileName)Tries to locate the given source file and opens a reader with the appropriate encoding.intgetTabWidth()Returns number of blank characters that represent a tab in source code.
-
-
-
Method Detail
-
add
public void add(ISourceFileLocator locator)
Adds the given locator. Locators are queried in the sequence they have been added.- Parameters:
locator- Additional locator to query
-
getSourceFile
public java.io.Reader getSourceFile(java.lang.String packageName, java.lang.String fileName) throws java.io.IOExceptionDescription copied from interface:ISourceFileLocatorTries to locate the given source file and opens a reader with the appropriate encoding.- Specified by:
getSourceFilein interfaceISourceFileLocator- Parameters:
packageName- VM name of the packagefileName- name of the source file- Returns:
- reader if the file could be located,
nullotherwise - Throws:
java.io.IOException- in case of problems while opening the file
-
getTabWidth
public int getTabWidth()
Description copied from interface:ISourceFileLocatorReturns number of blank characters that represent a tab in source code.- Specified by:
getTabWidthin interfaceISourceFileLocator- Returns:
- tab width as number of blanks
-
-