Class SourceHighlighter
- java.lang.Object
-
- org.jacoco.report.internal.html.page.SourceHighlighter
-
final class SourceHighlighter extends java.lang.ObjectCreates a highlighted output of a source file.
-
-
Constructor Summary
Constructors Constructor Description SourceHighlighter(java.util.Locale locale)Creates a new highlighter with default settings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) HTMLElementhighlight(HTMLElement pre, ILine line, int lineNr)voidrender(HTMLElement parent, ISourceNode source, java.io.Reader contents)Highlights the given source file.private voidrenderCodeLine(HTMLElement pre, java.lang.String linesrc, ILine line, int lineNr)voidsetLanguage(java.lang.String lang)Specifies the source language.private HTMLElementspan(HTMLElement parent, java.lang.String id, java.lang.String style1, java.lang.String style2, java.lang.String title, ICounter branches)
-
-
-
Method Detail
-
setLanguage
public void setLanguage(java.lang.String lang)
Specifies the source language. This value might be used for syntax highlighting. Default is "java".- Parameters:
lang- source language identifier
-
render
public void render(HTMLElement parent, ISourceNode source, java.io.Reader contents) throws java.io.IOException
Highlights the given source file.- Parameters:
parent- parent HTML elementsource- highlighting informationcontents- contents of the source file- Throws:
java.io.IOException- problems while reading the source file or writing the output
-
renderCodeLine
private void renderCodeLine(HTMLElement pre, java.lang.String linesrc, ILine line, int lineNr) throws java.io.IOException
- Throws:
java.io.IOException
-
highlight
HTMLElement highlight(HTMLElement pre, ILine line, int lineNr) throws java.io.IOException
- Throws:
java.io.IOException
-
span
private HTMLElement span(HTMLElement parent, java.lang.String id, java.lang.String style1, java.lang.String style2, java.lang.String title, ICounter branches) throws java.io.IOException
- Throws:
java.io.IOException
-
-