Takes the output and transforms it into a PDF file.
@param out Output stream.
@param rows Rows of data from reporting-core
@param columns Columns to list on report
978060
public void generatePdf(OutputStream out, List<Map<String, Object>> rows, List<ColumnDef> columns) {
        try {
            Document document = new Document();
            PdfWriter.getInstance(document, out);
            if (columns == null)
            {
                if (rows.size() > 0) return;
                columns = new ArrayList<ColumnDef>(CollectionUtils.collect(rows.get(0).keySet(), new Transformer() {
                    @Override
                    public Object transform(final Object input) {
                        return new ColumnDef()
                        {{
                                setName((String)input);
                            }};
                    }
                }));
            }
                if (columns.size() > 14)
                    document.setPageSize(PageSize.A1);
                else if (columns.size() > 10)
                    document.setPageSize(PageSize.A2);
                else if (columns.size() > 7)
                    document.setPageSize(PageSize.A3);
                else
                    document.setPageSize(PageSize.A4);
            document.open();
            Font font = FontFactory.getFont(FontFactory.COURIER, 8, Font.NORMAL, BaseColor.BLACK);
            Font headerFont = FontFactory.getFont(FontFactory.COURIER, 8, Font.BOLD, BaseColor.BLACK);

            int size = columns.size();
            PdfPTable table = new PdfPTable(size);
            for (ColumnDef column : columns)
            {
                PdfPCell c1 = new PdfPCell(new Phrase(column.getName(), headerFont));
                c1.setHorizontalAlignment(Element.ALIGN_CENTER);
                table.addCell(c1);
            }
            table.setHeaderRows(1);
            if (rows != null)
                for (Map<String, Object> row : rows)
                {
                    for (ColumnDef column : columns)
                    {
                        table.addCell(new Phrase(String.valueOf(row.get(column.getName())), font));
                    }
                }
            document.add(table);
            document.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
1085644
private byte[] getExcelOutput(FileColumn[] columns, List<String[]> lines) throws IOException
    {
        // Create the workbook
        baos = new ByteArrayOutputStream(1024);
        if(existing != null)
            workbook = Workbook.createWorkbook(format, baos, existing);
        else
            workbook = Workbook.createWorkbook(format, baos);

        workbook.setHeaders(hasHeaders());

        if(append && workbook.getSheet(worksheet) != null)
            workbook.appendToSheet(columns, lines, worksheet);
        else
            workbook.createSheet(columns, lines, worksheet);

        // Write out the workbook to the stream
        workbook.write();
        workbook.close();

        // The contents returned is the byte array
        return baos.toByteArray();
    }
6602
protected void writeRow(final String... columns) throws IOException {
		
		if( columns == null ) {
			throw new NullPointerException(String.format("columns to write should not be null on line %d", lineNumber));
		} else if( columns.length == 0 ) {
			throw new IllegalArgumentException(String.format("columns to write should not be empty on line %d",
				lineNumber));
		}
		
		StringBuilder builder = new StringBuilder();
		for( int i = 0; i < columns.length; i++ ) {
			
			columnNumber = i + 1; // column no used by CsvEncoder
			
			if( i > 0 ) {
				builder.append((char) preference.getDelimiterChar()); // delimiter
			}
			
			final String csvElement = columns[i];
			if( csvElement != null ) {
				final CsvContext context = new CsvContext(lineNumber, rowNumber, columnNumber);
				final String escapedCsv = encoder.encode(csvElement, context, preference);
				builder.append(escapedCsv);
				lineNumber = context.getLineNumber(); // line number can increment when encoding multi-line columns
			}
			
		}
		
		builder.append(preference.getEndOfLineSymbols()); // EOL
		writer.write(builder.toString());
	}
378087
public function draw(array $columnNames, array $rows, int $writer = Output::STANDARD): void
	{
		$this->output->write($this->render($columnNames, $rows), $writer);
	}
1285760
public void setOutputs(java.util.Map<String, java.util.List<String>> outputs) {
        this.outputs = outputs;
    }
893279
public void writeToExcel(List<? extends Object> datas, boolean hasTitle,
                             OutputStream outputStream, boolean transverse) throws IOException {
        writeToExcel(datas, hasTitle, outputStream, IN_MEMORY, transverse);
    }
1011339
@SafeVarargs
  public final TypedDataSet<T> rows(T... rows)  {
    for (T rowObj : rows) {
      super.row(conv.convert(rowObj));
    }
    return this;
  }
1281624
public void write(Writer out)
        throws IOException
    {
        if (bottomButtons!=null)
        {
            table.newRow();
            table.addCell(bottomButtons).attribute("colspan",columns);
        }
        super.write(out);
    }
807688
public void printEndRecordGridData(PrintWriter out, int iPrintOptions)
    {
        out.println("</table>");
        if ((iPrintOptions & HtmlConstants.DETAIL_SCREEN) == HtmlConstants.DETAIL_SCREEN)
        {
            out.println("</td>\n</tr>");
        }
    }
821857
private void appendList(Output out, Collection collection, String separator, boolean areColumns) {
        Iterator it = collection.iterator();
        boolean hasNext = it.hasNext();
        //boolean areColumns = (columns == collection);

        while (hasNext) {
            Outputable sqlToken = (Outputable) it.next();
            hasNext = it.hasNext();
            sqlToken.write(out);
            if (areColumns) {
                Column column = (Column) sqlToken;
                String columnAlias = column.getAlias();
                if (columnAlias != null) {
                    out.print(" AS ");
                    out.print("\"");
                    out.print(columnAlias);
                    out.print("\"");
                }
            }
            if (hasNext) {
                out.print(separator);
                out.println();
            }
        }
    }
477685
private void serializeBinds(Map<String, ParameterBindingDTO> bindValues) throws BindException
  {
    List<ColumnTypeDataPair> columns = getColumnValues(bindValues);
    List<String[]> rows = buildRows(columns);
    writeRowsToCSV(rows);
  }
209948
private void writeRow(String... columns) throws IOException {
        StringBuilder html = new StringBuilder();
        html.append("<tr>");
        for(String data : columns) {
            html.append("<td>").append(data).append("</td>");
        }
        html.append("</tr>\n");
        writer.write(html.toString());
    }
1130746
private List onRead(EntityMetadata m, List<Map<String, Object>> columnsToOutput, Table hTable,
            List<HBaseDataWrapper> results) throws IOException
    {
        Class clazz = m.getEntityClazz();
        List outputResults = new ArrayList();
        try
        {
            if (results != null)
            {
                return columnsToOutput != null && !columnsToOutput.isEmpty() ? returnSpecificFieldList(m,
                        columnsToOutput, results, outputResults) : returnEntityObjectList(m, results, outputResults);
            }
        }
        catch (Exception e)
        {
            logger.error("Error while creating an instance of {}, Caused by: .", clazz, e);
            throw new PersistenceException(e);
        }
        finally
        {
            if (hTable != null)
            {
                closeHTable(hTable);
            }
        }
        return outputResults;
    }
397972
public static void printColumns(final Terminal terminal, final PrintWriter out, final Stream<String> values, final boolean horizontal) {
    int width = terminal.getWidth();
    List<AttributedString> strings = values.map(AttributedString::fromAnsi).collect(Collectors.toList());

    if (!strings.isEmpty()) {
      int max = strings.stream().mapToInt(AttributedString::columnLength).max().orElse(0);
      int c = Math.max(1, width / max);
      while (c > 1 && c * max + (c - 1) >= width) {
        c--;
      }

      int columns = c;
      int lines = (strings.size() + columns - 1) / columns;
      IntBinaryOperator index;

      if (horizontal) {
        index = (i, j) -> i * columns + j;
      }
      else {
        index = (i, j) -> j * lines + i;
      }

      AttributedStringBuilder buff = new AttributedStringBuilder();
      for (int i = 0; i < lines; i++) {
        for (int j = 0; j < columns; j++) {
          int idx = index.applyAsInt(i, j);
          if (idx < strings.size()) {
            AttributedString str = strings.get(idx);
            boolean hasRightItem = j < columns - 1 && index.applyAsInt(i, j + 1) < strings.size();
            buff.append(str);
            if (hasRightItem) {
              for (int k = 0; k <= max - str.length(); k++) {
                buff.append(' ');
              }
            }
          }
        }
        buff.append('\n');
      }

      out.print(buff.toAnsi(terminal));
    }
  }
418753
public static void print(final Collection<? extends CharSequence> columns) {
        print(new Applyable<ConsoleReaderWrapper>() {
            public void apply(ConsoleReaderWrapper consoleReaderWrapper) {
                consoleReaderWrapper.print(columns);
            }
        });
    }
38974
public void exportObjects2Excel(List<?> data, List<String> header, String targetPath)
            throws IOException {

        try (OutputStream fos = new FileOutputStream(targetPath);
             Workbook workbook = exportExcelBySimpleHandler(data, header, null, true)) {
            workbook.write(fos);
        }
    }
1025670
public static void exportToStream(final OutputStream outputStream, final Iterable<? extends NodeInterface> nodes, final Iterable<? extends RelationshipInterface> relationships, final Iterable<String> filePaths, final boolean includeFiles) throws FrameworkException {

		try (final ZipOutputStream zos = new ZipOutputStream(outputStream)) {

			final Set<String> filesToInclude = new LinkedHashSet<>();
			if (filePaths != null) {

				for (String file : filePaths) {

					filesToInclude.add(file);
				}
			}

			// set compression
			zos.setLevel(6);

			if (includeFiles) {

				logger.info("Exporting files..");

				// export files first
				exportDirectory(zos, new File("files"), "", filesToInclude.isEmpty() ? null : filesToInclude);
			}

			// export database
			exportDatabase(zos, new BufferedOutputStream(zos), nodes, relationships);

			// finish ZIP file
			zos.finish();

			// close stream
			zos.flush();
			zos.close();

		} catch (Throwable t) {

			logger.warn("", t);

			throw new FrameworkException(500, t.getMessage());
		}
	}