public class ContextReport extends Report
Modifier and Type | Field and Description |
---|---|
static int |
tabWidth
The number of spaces a tab is equivalent to.
|
Constructor and Description |
---|
ContextReport(java.io.OutputStream os)
Creates a context report for the given output stream.
|
ContextReport(java.io.OutputStream os,
java.io.File file)
Creates a context report for the given output stream, and file.
|
ContextReport(java.io.OutputStream os,
java.lang.String source)
Creates a context report for the given output stream, and string source.
|
ContextReport(java.io.Writer writer)
Creates a context report for the given writer.
|
ContextReport(java.io.Writer writer,
java.io.File file)
Creates a context report for the given writer, and a file source.
|
ContextReport(java.io.Writer writer,
java.lang.String source)
Creates a context report for the given writer, and a string source.
|
Modifier and Type | Method and Description |
---|---|
protected void |
indent(java.lang.StringBuffer buf,
int line,
int column,
char ch)
Adds indentation to the buffer, replacing spacing and tabs.
|
protected void |
markToEndOfLine(java.lang.StringBuffer buf,
int line,
int column)
Marks the given line with leading spaces to the column position
(inclusive), and from there marking to the end of the line with
"<---...".
|
protected void |
markToStartPosition(java.lang.StringBuffer buf,
int line,
int column)
Marks the given line with "...--->" leading to the column position
(inclusive).
|
void |
reset(java.io.File file)
Associates the given file with the list of violations, including that are
adding to this report later, i.e., prior to
flush . |
void |
reset(java.lang.String source)
Associates the given string source with the list of violations, including
that are adding to this report later, i.e., prior to
flush . |
protected java.lang.String |
toString(Violation violation)
Returns a string representing the given violation, consistent with the
format of the Report subclass.
|
protected void |
underline(java.lang.StringBuffer buf,
int line,
int beginColumn,
int endColumn)
Underlines ("<--...-->") from
beginColumn to
endColumn in the given line. |
protected void |
writeLine(java.lang.StringBuffer buf,
int line)
Writes the given line, adding the line number, right-aligned.
|
addViolation, flush, getViolations, write
public ContextReport(java.io.Writer writer)
writer
- The writer associated with this report.public ContextReport(java.io.OutputStream os)
os
- The output stream associated with this report.public ContextReport(java.io.Writer writer, java.lang.String source)
writer
- The writer associated with this report.source
- The source code to which this report applies.public ContextReport(java.io.Writer writer, java.io.File file)
writer
- The writer associated with this report.file
- The file, containing source code, to which this report applies.public ContextReport(java.io.OutputStream os, java.lang.String source)
os
- The output stream associated with this report.source
- The source code to which this report applies.public ContextReport(java.io.OutputStream os, java.io.File file)
os
- The output stream associated with this report.file
- The file, containing source code, to which this report applies.public void reset(java.io.File file)
flush
.public void reset(java.lang.String source)
flush
.protected java.lang.String toString(Violation violation)
protected void indent(java.lang.StringBuffer buf, int line, int column, char ch)
tabWidth
occurrences of ch
.buf
- The buffer to be written to.line
- The current line number.column
- The column to indent to.ch
- The character with which to replace spaces and tabs.protected void markToEndOfLine(java.lang.StringBuffer buf, int line, int column)
buf
- The buffer to be written to.line
- The current line number.column
- The column to mark to/from.protected void markToStartPosition(java.lang.StringBuffer buf, int line, int column)
buf
- The buffer to be written to.line
- The current line number.column
- The column to mark to.protected void underline(java.lang.StringBuffer buf, int line, int beginColumn, int endColumn)
beginColumn
to
endColumn
in the given line. If the columns are equal, a
single caret is shown.buf
- The buffer to be written to.line
- The current line number.beginColumn
- The column to mark from.endColumn
- The column to mark to.protected void writeLine(java.lang.StringBuffer buf, int line)
buf
- The buffer to be written to.line
- The current line number.