@Override public void reportToStdOut(final Trace trace, final ReportSettings settings) { new ReportService().reportTraceToStdOut(trace, settings); }
@Override public void reportToPath(final Trace trace, final Path outputPath, final ReportSettings settings) { new ReportService().reportTraceToPath(trace, outputPath, settings); } }
public void reportTraceToStdOut(final Trace trace, final ReportSettings settings) { reportTraceToStream(trace, getStdOutStream(), settings); }
private void reportTraceToStream(final Trace trace, final OutputStream outputStream, final ReportSettings settings) { final Reportable report = createReport(trace, settings); report.renderToStream(outputStream); try { outputStream.flush(); } catch (final IOException exception) { throw new ReportException(exception.getMessage()); } }
protected Reportable createReport(final Trace trace, final ReportSettings settings) { Reportable report = null; final String format = settings.getOutputFormat(); switch (ReportFormat.parse(format)) { case PLAIN_TEXT: report = new PlainTextReport(trace, settings); break; case HTML: report = new HtmlReport(trace); break; default: throw new IllegalArgumentException( "Unable to create report with format \"" + format + "\""); } return report; }
public void reportTraceToPath(final Trace trace, final Path outputPath, final ReportSettings settings) { try (OutputStream outputStream = Files.newOutputStream(outputPath)) { reportTraceToStream(trace, outputStream, settings); } catch (final IOException e) { throw new ReportException("Error generating stream to output path " + outputPath, e); } }
@Override public void renderToStream(final OutputStream outputStream) { final Charset charset = StandardCharsets.UTF_8; try (final PrintStream report = new PrintStream(outputStream, false, charset.displayName())) { renderToPrintStream(report); } catch (final UnsupportedEncodingException e) { throw new ReportException("Encoding charset '" + charset + "' not supported", e); } }
private void inlineCSS() { try (final InputStream css = this.cssURL.openStream()) { final byte[] buffer = new byte[4096]; int n; while ((n = css.read(buffer)) > 0) { this.stream.write(buffer, 0, n); } } catch (final IOException e) { throw new ReportException("Unable to copy CSS content \"" + this.cssURL.toString() + "\" trying to generate HTML view.", e); } }
private void reportTraceToStream(final Trace trace, final OutputStream outputStream, final ReportSettings settings) { final Reportable report = createReport(trace, settings); report.renderToStream(outputStream); try { outputStream.flush(); } catch (final IOException exception) { throw new ReportException(exception.getMessage()); } }
protected Reportable createReport(final Trace trace, final ReportSettings settings) { Reportable report = null; final String format = settings.getOutputFormat(); switch (ReportFormat.parse(format)) { case PLAIN_TEXT: report = new PlainTextReport(trace, settings); break; case HTML: report = new HtmlReport(trace); break; default: throw new IllegalArgumentException( "Unable to create report with format \"" + format + "\""); } return report; }
@Override public void reportToStdOut(final Trace trace, final ReportSettings settings) { new ReportService().reportTraceToStdOut(trace, settings); }
@Override public void reportToPath(final Trace trace, final Path outputPath, final ReportSettings settings) { new ReportService().reportTraceToPath(trace, outputPath, settings); } }
public void reportTraceToPath(final Trace trace, final Path outputPath, final ReportSettings settings) { try (OutputStream outputStream = Files.newOutputStream(outputPath)) { reportTraceToStream(trace, outputStream, settings); } catch (final IOException e) { throw new ReportException("Error generating stream to output path " + outputPath, e); } }
public void reportTraceToStdOut(final Trace trace, final ReportSettings settings) { reportTraceToStream(trace, getStdOutStream(), settings); }
@Override public void renderToStream(final OutputStream outputStream) { final Charset charset = StandardCharsets.UTF_8; try (final PrintStream report = new PrintStream(outputStream, false, charset.displayName())) { renderToPrintStream(report); } catch (final UnsupportedEncodingException e) { throw new ReportException("Encoding charset '" + charset + "' not supported", e); } }
private void inlineCSS() { try (final InputStream css = this.cssURL.openStream()) { final byte[] buffer = new byte[4096]; int n; while ((n = css.read(buffer)) > 0) { this.stream.write(buffer, 0, n); } } catch (final IOException e) { throw new ReportException("Unable to copy CSS content \"" + this.cssURL.toString() + "\" trying to generate HTML view.", e); } }
@Override public void reportToStdOut(final Trace trace) { new ReportService().reportTraceToStdOut(trace, ReportSettings.createDefault()); }
@Override public void reportToPath(final Trace trace, final Path outputPath) { new ReportService().reportTraceToPath(trace, outputPath, ReportSettings.createDefault()); }
@Override public void reportToStdOut(final Trace trace) { new ReportService().reportTraceToStdOut(trace, ReportSettings.createDefault()); }
@Override public void reportToPath(final Trace trace, final Path outputPath) { new ReportService().reportTraceToPath(trace, outputPath, ReportSettings.createDefault()); }