public String format()

in src/main/java/com/googlesource/gerrit/plugins/xdocs/formatter/ZipFormatter.java [38:72]


  public String format(
      String projectName,
      String path,
      String revision,
      String abbrRev,
      ConfigSection globalCfg,
      InputStream raw)
      throws IOException {
    html.startDocument()
        .openHead()
        .closeHead()
        .openBody()
        .openTable("xdoc-zip-table")
        .appendCellHeader("name")
        .appendCellHeader("size")
        .appendCellHeader("last modified");
    try (ZipInputStream zip = new ZipInputStream(raw)) {
      for (ZipEntry entry; (entry = zip.getNextEntry()) != null; ) {
        html.openRow().appendCell(entry.getName());
        if (!entry.isDirectory()) {
          if (entry.getSize() != -1) {
            html.appendCell(FileUtils.byteCountToDisplaySize(entry.getSize()));
          } else {
            html.appendCell("n/a");
          }
        } else {
          html.appendCell();
        }
        html.appendDateCell(entry.getTime()).closeRow();
      }
    }
    html.closeTable().closeBody().endDocument();

    return util.applyCss(html.toString(), NAME, projectName);
  }