Package org.jacoco.report
Class InputStreamSourceFileLocator
- java.lang.Object
-
- org.jacoco.report.InputStreamSourceFileLocator
-
- All Implemented Interfaces:
ISourceFileLocator
- Direct Known Subclasses:
AntFilesLocator,DirectorySourceFileLocator
public abstract class InputStreamSourceFileLocator extends java.lang.Object implements ISourceFileLocator
Abstract base class forISourceFileLocatorlocator implementations based onInputStreams. It handles the encoding and tab width.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedInputStreamSourceFileLocator(java.lang.String encoding, int tabWidth)Creates a new locator with the given specification.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description 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.protected abstract java.io.InputStreamgetSourceStream(java.lang.String path)Tries to locate the given source file and opens its binary content.intgetTabWidth()Returns number of blank characters that represent a tab in source code.
-
-
-
Constructor Detail
-
InputStreamSourceFileLocator
protected InputStreamSourceFileLocator(java.lang.String encoding, int tabWidth)Creates a new locator with the given specification.- Parameters:
encoding- encoding of the source files,nullfor platform default encodingtabWidth- tab width in source files as number of blanks
-
-
Method Detail
-
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
-
getSourceStream
protected abstract java.io.InputStream getSourceStream(java.lang.String path) throws java.io.IOExceptionTries to locate the given source file and opens its binary content.- Parameters:
path- local path to the resource- Returns:
- stream if the file could be located,
nullotherwise - Throws:
java.io.IOException- in case of problems while opening the stream
-
-