MetricsReportWriterTextReportWriter, XmlReportWriterpublic abstract class OutputStreamReportWriter extends java.lang.Object implements MetricsReportWriter
OutputStream.
Note that the protected write* methods throw an UncheckedIOException rather than
an IOException. This is to allow these methods to be called in methods intended to
implement functional interfaces that don't throw IOException. The main entry point for
this class, writeReport(JavaMetrics, MetricsReportMetaData), catches any thrown
UncheckedIOException and throws its IOException cause.
| Modifier | Constructor | Description |
|---|---|---|
protected |
OutputStreamReportWriter(java.io.OutputStream pOutputStream,
java.nio.charset.Charset pCharset) |
Create a new
OutputStreamReportWriter. |
| Modifier and Type | Method | Description |
|---|---|---|
protected void |
decreaseIndentationLevel() |
Decrease the indentation level used by
writeIndentation(). |
protected void |
flush() |
Flush any buffered writes to the underlying stream.
|
protected void |
increaseIndentationLevel() |
Increase the indentation level used by
writeIndentation(). |
protected void |
write(char pChar) |
Write a single character to the underlying stream.
|
protected void |
write(char[] pChars) |
Write all characters in an array to the underlying stream.
|
protected void |
write(java.lang.String pChars) |
Write all characters in a string to the underlying stream.
|
protected void |
writeIndentation() |
Write the current indentation to the underlying stream.
|
protected void |
writeLineBreak() |
Write the platform's line separator to the underlying stream.
|
void |
writeReport(JavaMetrics pMetrics,
MetricsReportMetaData pMetaData) |
Write a report for the source code metrics in a
JavaMetrics instance. |
protected abstract void |
writeReportContents(JavaMetrics pMetrics,
MetricsReportMetaData pMetaData) |
Write the report's contents to the underlying stream.
|
protected OutputStreamReportWriter(@Nonnull
java.io.OutputStream pOutputStream,
@Nonnull
java.nio.charset.Charset pCharset)
OutputStreamReportWriter.pOutputStream - The stream to write the report to.pCharset - The character set to encode the report with.java.lang.NullPointerException - if any of the parameters is null.public void writeReport(@Nonnull
JavaMetrics pMetrics,
@Nonnull
MetricsReportMetaData pMetaData)
throws java.io.IOException
JavaMetrics instance.writeReport in interface MetricsReportWriterpMetrics - The metrics to get the report data from.pMetaData - The report's meta data.java.io.IOException - if writing to the underlying stream fails.java.lang.NullPointerException - if any of the parameters is null.protected abstract void writeReportContents(@Nonnull
JavaMetrics pMetrics,
@Nonnull
MetricsReportMetaData pMetaData)
pMetrics - The metrics to get the report data from.pMetaData - The report's meta data.java.io.UncheckedIOException - if writing to the underlying stream fails.java.lang.NullPointerException - if any of the parameters is null.protected void increaseIndentationLevel()
writeIndentation().protected void decreaseIndentationLevel()
writeIndentation().protected void writeIndentation()
java.io.UncheckedIOException - if writing to the underlying stream fails.protected void writeLineBreak()
java.io.UncheckedIOException - if writing to the underlying stream fails.protected void write(char pChar)
pChar - The character to write.java.io.UncheckedIOException - if writing to the underlying stream fails.protected void write(@Nonnull
char[] pChars)
pChars - The characters to write.java.io.UncheckedIOException - if writing to the underlying stream fails.java.lang.NullPointerException - if pChars is null.protected void write(@Nonnull
java.lang.String pChars)
pChars - The characters to write.java.io.UncheckedIOException - if writing to the underlying stream fails.java.lang.NullPointerException - if pChars is null.protected void flush()
java.io.UncheckedIOException - if flushing to the underlying stream fails.