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:com.zimbra.cs.mailbox.util.MetadataDump.java

private static void printBanner(PrintStream out, String title) {
    out.println("********************   " + title + "   ********************");
}

From source file:ShowHTMLViews.java

public static void displayView(View view, int indent, Document doc, PrintStream out) {
    String name = view.getClass().getName();
    for (int i = 0; i < indent; i++) {
        out.print("  ");
    }/*from ww  w .  j av  a 2 s  .  co m*/

    int start = view.getStartOffset();
    int end = view.getEndOffset();
    out.println(name + "; offsets [" + start + ", " + end + "]");
    for (int i = 0; i < indent; i++) {
        out.print("  ");
    }
    HTMLDocDisplay.displayAttributes(view.getAttributes(), indent, out);
    int viewCount = view.getViewCount();
    if (viewCount == 0) {
        int length = Math.min(32, end - start);
        try {
            String txt = doc.getText(start, length);
            for (int i = 0; i < indent + 1; i++) {
                out.print("  ");
            }
            out.println("[" + txt + "]");
        } catch (BadLocationException e) {
        }
    } else {
        for (int i = 0; i < viewCount; i++) {
            displayView(view.getView(i), indent + 1, doc, out);
        }
    }
    out.println("");
}

From source file:de.tsystems.mms.apm.performancesignature.util.PerfSigUIUtils.java

public static void handleIncidents(final Run<?, ?> run, final List<IncidentChart> incidents,
        final PrintStream logger, final int nonFunctionalFailure) {
    int numWarning = 0, numSevere = 0;
    if (incidents != null && !incidents.isEmpty()) {
        logger.println(Messages.PerfSigUIUtils_FollowingIncidents());
        for (IncidentChart incident : incidents) {
            for (IncidentViolation violation : incident.getViolations()) {
                switch (violation.getSeverity()) {
                case SEVERE:
                    logger.println(Messages.PerfSigUIUtils_SevereIncident(incident.getRule(),
                            violation.getRule(), violation.getDescription()));
                    numSevere++;/*from www .j a  v a 2s  .  co m*/
                    break;
                case WARNING:
                    logger.println(Messages.PerfSigUIUtils_WarningIncident(incident.getRule(),
                            violation.getRule(), violation.getDescription()));
                    numWarning++;
                    break;
                default:
                    break;
                }
            }
        }

        switch (nonFunctionalFailure) {
        case 1:
            if (numSevere > 0) {
                logger.println(Messages.PerfSigUIUtils_BuildsStatusSevereIncidentsFailed());
                run.setResult(Result.FAILURE);
            }
            break;
        case 2:
            if (numSevere > 0 || numWarning > 0) {
                logger.println(Messages.PerfSigUIUtils_BuildsStatusWarningIncidentsFailed());
                run.setResult(Result.FAILURE);
            }
            break;
        case 3:
            if (numSevere > 0) {
                logger.println(Messages.PerfSigUIUtils_BuildsStatusSevereIncidentsUnstable());
                run.setResult(Result.UNSTABLE);
            }
            break;
        case 4:
            if (numSevere > 0 || numWarning > 0) {
                logger.println(Messages.PerfSigUIUtils_BuildsStatusWarningIncidentsUnstable());
                run.setResult(Result.UNSTABLE);
            }
            break;
        default:
            break;
        }
    }
}

From source file:fr.certu.chouette.plugin.report.Report.java

/**
 * pretty print recursively reportItems//w w  w  .j a v a2 s. c  o m
 * 
 * @param stream
 *           target stream
 * @param indent
 *           indentation
 * @param item
 *           items to print
 */
private static void printItems(PrintStream stream, String indent, List<ReportItem> items) {
    if (items == null)
        return;
    for (ReportItem item : items) {
        stream.println(indent + item.getStatus().name() + " : " + item.getLocalizedMessage());
        printItems(stream, indent + "   ", item.getItems());
    }

}

From source file:com.amazonaws.services.kinesis.multilang.MultiLangDaemon.java

/**
 * Utility for describing how to run this app.
 * // w w  w  .java  2s  . c o  m
 * @param stream Where to output the usage info.
 * @param messageToPrepend An optional error message to describe why the usage is being printed.
 */
public static void printUsage(PrintStream stream, String messageToPrepend) {
    StringBuilder builder = new StringBuilder();
    if (messageToPrepend != null) {
        builder.append(messageToPrepend);
    }
    builder.append(String.format("java %s <properties file>", MultiLangDaemon.class.getCanonicalName()));
    stream.println(builder.toString());
}

From source file:ShowHTMLViews.java

public static void displayAttributes(AttributeSet a, int indent, PrintStream out) {
    if (a == null)
        return;/* w w w .  j av a2  s.c om*/

    a = a.copyAttributes();
    Enumeration x = a.getAttributeNames();
    for (int i = 0; i < indent; i++) {
        out.print("  ");
    }
    if (x != null) {
        out.println("ATTRIBUTES:");
        while (x.hasMoreElements()) {

            for (int i = 0; i < indent; i++) {
                out.print("  ");
            }
            Object attr = x.nextElement();
            out.println(
                    " (" + attr + ", " + a.getAttribute(attr) + ")" + " [" + getShortClassName(attr.getClass())
                            + "/" + getShortClassName(a.getAttribute(attr).getClass()) + "] ");
        }
    } else {
        out.println("No attributes");
    }
    if (a.getResolveParent() != null) {
        displayAttributes(a.getResolveParent().copyAttributes(), indent + 1, out);
    }
}

From source file:com.aliyun.openservices.odps.console.file.FileOperationCommand.java

public static void printUsage(PrintStream out) {
    out.println("");
    out.println("Usage: fs <-ls [-l] | -rmv | -rmp > <path>;     list or remove volume[partition]");
    out.println("       fs <-put | -get > <src> <dest>;          put  or get file[dir].");
    out.println("       fs <-mkv > <volume_name> [comment];      create volume.");
    out.println("       fs <-meta > <path>;                      desc meta.");
    out.println("For example:");
    out.println("       fs -ls /;   list volumes.");
    out.println("       fs -put /home/admin/data /vname/pname;   ");
    out.println("       fs -mkv test_volume  'for test';    ");
}

From source file:TestOpenMailRelay.java

/** Try the given mail server, writing output to the given PrintStream */
public static void process(String suspect_relay, PrintStream pw) {
    pw.println("processs: trying: " + suspect_relay);
    try {//from   ww  w  .  j  a  va 2s . c o m
        // Redirect all output from mail API to the given stream.
        System.setOut(pw);
        System.setErr(pw);
        Sender2 sm = new Sender2(suspect_relay);
        sm.addRecipient("nobody@erewhon.moc");
        sm.setFrom(MY_TARGET);
        sm.setSubject("Testing for open mail relay, see " + RSS_SITE);
        sm.setBody("This mail is an attempt to confirm that site " + suspect_relay + "\n"
                + "is in fact an open mail relay site.\n"
                + "For more information on the problem of open mail relays,\n" + "please visit site " + RSS_SITE
                + "\n" + "Please join the fight against spam by closing all open mail relays!\n"
                + "If this open relay has been closed, please accept our thanks.\n");
        sm.sendFile("");
    } catch (MessagingException e) {
        pw.println(e);
    } catch (Exception e) {
        pw.println(e);
    }
}

From source file:com.ibm.team.build.internal.hjplugin.RTCFacadeFactory.java

private static void debug(PrintStream debugLog, String msg) {
    LOGGER.finer(msg);/*  w w  w . j  a v a2  s  .c  om*/
    if (debugLog != null) {
        debugLog.println(msg);
    }
}

From source file:gov.nih.nci.cagrid.identifiers.test.StressTestUtil.java

private synchronized static void writeToFile(String line) {
    FileOutputStream fout = null;
    try {//from w w w .ja  v a2  s.  c  om
        fout = new FileOutputStream(fileName, true);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
    if (fout != null) {
        PrintStream p = new PrintStream(fout);
        p.println(line);
        p.close();
    }
}