code: protected void processTemplate(String templateName, OutputStream outputStream) throws ReportException {
          InputStream input = null;
          String logTag = null;
          final File f = new File(templateName);
          try {
              if (f.isFile()) {
                  try {
                      logTag = templateName;
                      input = new FileInputStream(f);
                  } catch (FileNotFoundException ex) {
                      throw new ReportException("Unable to locate template file: " + templateName, ex);
                  }
              } else {
                  logTag = "templates/" + templateName + ".vsl";
                  input = FileUtils.getResourceAsStream(logTag);
              }
              if (input == null) {
                  logTag = templateName;
                  input = FileUtils.getResourceAsStream(templateName);
              }
              if (input == null) {
                  throw new ReportException("Template file doesn't exist: " + logTag);
              }
  
              try (InputStreamReader reader = new InputStreamReader(input, StandardCharsets.UTF_8);
                      OutputStreamWriter writer = new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)) {
                  if (!velocityEngine.evaluate(context, writer, logTag, reader)) {
                      throw new ReportException("Failed to convert the template into html.");
                  }
                  writer.flush();
              } catch (UnsupportedEncodingException ex) {
                  throw new ReportException("Unable to generate the report using UTF-8", ex);
              } catch (IOException ex) {
                  throw new ReportException("Unable to write the report", ex);
              }
          } finally {
              if (input != null) {
                  try {
                      input.close();
                  } catch (IOException ex) {
                      LOGGER.trace("Error closing input", ex);
                  }
              }
          }
      }
docs: Generates a report from a given Velocity Template. The template name
  provided can be the name of a template contained in the jar file, such as
  'XmlReport' or 'HtmlReport', or the template name can be the path to a
  template file.
  
  @param templateName the name of the template to load
  @param outputStream the OutputStream to write the report to
  @throws ReportException is thrown when an exception occurs