Example usage for java.io PrintStream println

List of usage examples for java.io PrintStream println

Introduction

In this page you can find the example usage for java.io PrintStream println.

Prototype

public void println(Object x) 

Source Link

Document

Prints an Object and then terminate the line.

Usage

From source file:GenericsTester.java

public void printList(List<?> list, PrintStream out) throws IOException {
    for (Iterator<?> i = list.iterator(); i.hasNext();) {
        out.println(i.next().toString());
    }/*w  w  w.ja v a2  s.  co m*/
}

From source file:jenkins.plugins.asqatasun.AsqatasunRunner.java

private String getNbStatus(PrintStream ps, boolean isFirstNb, String line) {
    ps.println(line);
    if (isFirstNb) {
        return StringUtils.substring(line, StringUtils.indexOf(line, ":") + 1).trim();
    }/*from  ww w. j a  va2  s. c om*/
    return null;
}

From source file:com.sangupta.clitools.file.HexDump.java

public static void hexDump(PrintStream outStream, BufferedInputStream bis, int currentRow, int maxRows)
        throws IOException {
    int row = currentRow + 1;
    if (maxRows == 0) {
        maxRows = Integer.MAX_VALUE;
    } else {//from   ww w  .j av a 2s . c  om
        maxRows += currentRow;
    }

    StringBuilder builder1 = new StringBuilder(100);
    StringBuilder builder2 = new StringBuilder(100);

    while (bis.available() > 0) {
        outStream.printf("%04X  ", row * 16);
        for (int j = 0; j < 16; j++) {
            if (bis.available() > 0) {
                int value = (int) bis.read();
                builder1.append(String.format("%02X ", value));

                if (!Character.isISOControl(value)) {
                    builder2.append((char) value);
                } else {
                    builder2.append(".");
                }
            } else {
                for (; j < 16; j++) {
                    builder1.append("   ");
                }
            }
        }
        outStream.print(builder1);
        outStream.println(builder2);
        row++;

        if (row > maxRows) {
            break;
        }

        builder1.setLength(0);
        builder2.setLength(0);
    }
}

From source file:GenericsTester.java

private void printListOfStrings(List<String> list, PrintStream out) throws IOException {

    for (Iterator<String> i = list.iterator(); i.hasNext();) {
        out.println(i.next());
    }/*from   w w  w  .  j  a  va 2s . c om*/
}

From source file:com.alibaba.dragoon.client.jmx.Threading.java

public void dump(PrintStream out) {
    out.println("DaemonThreadCount : " + this.getDaemonThreadCount());
    out.println("ThreadCount : " + this.getThreadCount());

    out.println("NewThreadCount : " + this.getNewThreadCount());
    out.println("RunnableThreadCount : " + this.getRunnableThreadCount());
    out.println("BlockedThreadCount : " + this.getBlockedThreadCount());
    out.println("WaitingThreadCount : " + this.getWaitingThreadCount());
    out.println("TimedWaitingThreadCount : " + this.getTimedWaitingThreadCount());
    out.println("TeminatedThreadCount : " + this.getTeminatedThreadCount());

    out.println("DeadLockedThreadCount : " + this.getDeadLockedThreadCount());
    out.println("TotalStartedThreadCount : " + this.getTotalStartedThreadCount());

    out.println("ProcessCpuTimeRate : " + this.getProcessCpuTimeRate());
    out.println("FullGCCollectionTimeRate : " + this.getFullGCCollectionTimeRate());
}

From source file:ThreadTester.java

private void printArray(int[] a, PrintStream out) throws IOException {
    for (int n : a) {
        out.println(n);
    }/*from   ww w  .j  av a2  s . co m*/
    out.println();
}

From source file:org.nuxeo.client.internals.spi.NuxeoClientException.java

@Override
public void printStackTrace(PrintStream s) {
    if (status == INTERNAL_ERROR_STATUS) {
        super.printStackTrace(s);
    }//from  ww w  .  ja v  a  2 s  . c om
    s.println("Exception:");
    s.print(getRemoteStackTrace());
}

From source file:com.thoughtworks.go.domain.UnitTestReportGenerator.java

public void merge(File[] testFiles, OutputStream outputStream) throws IOException {
    PrintStream out = new PrintStream(outputStream, true, "UTF-8");
    out.println("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
    out.println("<all-results>");

    for (File testFile : testFiles) {
        if (testFile.isDirectory()) {
            for (Object file : FileUtils.listFiles(testFile, new String[] { "xml" }, true)) {
                pumpFileContentIfValid(out, (File) file);
            }//from   w  w w  .jav  a 2s.c o  m
        } else {
            pumpFileContentIfValid(out, testFile);
        }
    }
    out.println("</all-results>");
}

From source file:uk.ac.ebi.intact.editor.controller.misc.ErrorController.java

private String createIssueContent() {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    ps.println("<b>Reporter:</b> " + userSessionController.getCurrentUser().getLogin() + " <br/>");
    ps.println("<b>ViewId:</b> " + viewId + "<br/>");
    ps.println("<b>Referer:</b> " + referer + "<br/>");
    ps.println("<b>Exception message:</b> " + throwable.getMessage() + "<br/>");

    ps.println("<p>" + explanation + "</p>");
    ps.close();/*from   ww w .  j a v  a 2s .c o m*/

    return baos.toString();
}

From source file:uk.ac.ebi.intact.editor.controller.misc.ErrorController.java

public String createExceptionMessage() {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    ps.println("ViewId: " + viewId);
    ps.println("Referer: " + referer);
    ps.println("---------------------------------------------");

    if (throwable != null)
        throwable.printStackTrace(ps);/*from ww w.ja  v  a 2s .  co  m*/

    ps.close();

    return baos.toString();
}