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() 

Source Link

Document

Terminates the current line by writing the line separator string.

Usage

From source file:Main.java

public static void main(String[] args) {

    PrintStream ps = new PrintStream(System.out);

    // print this string
    ps.print("This is a String");

    // print new line
    ps.println();

    // print a new string
    ps.println("from java2s.com");

    // flush the stream
    ps.flush();//w  w w. j a  v  a2s.c  o m

}

From source file:Main.java

public static void main(String[] args) {
    String s = "from java2s.com.";

    PrintStream ps = new PrintStream(System.out);

    // print our string
    ps.print(s);/*from ww w.jav  a 2 s  .com*/

    // flush the stream to see the results
    ps.flush();

    // print new string
    ps.println();
    ps.print("This is an example");

    // flush to see new string
    ps.flush();

}

From source file:edu.hku.sdb.driver.SdbDriver.java

private static void printUsage(PrintStream out) {

    out.println();
    out.println("Usage: start-sdb.sh");
    out.println(" -start                     Start the SDB proxy");
    out.println(" -conf <dir>              Sdb configuration directory");
    out.println(" -help                        Print this usage");
    out.println("");

}

From source file:info.mikaelsvensson.devtools.analysis.db2eventlog.Db2EventLogReportGenerator.java

private static void printHeader(PrintStream stream, String header) {
    stream.println();
    stream.println(header);//www.j  a va  2 s.  c om
    stream.println(StringUtils.repeat('-', header.length()));
    stream.println();
}

From source file:mx.bigdata.cfdi.CFDv3.java

public static void dump(String title, byte[] bytes, PrintStream out) {
    out.printf("%s: ", title);
    for (byte b : bytes) {
        out.printf("%02x ", b & 0xff);
    }/*  ww w  .  ja v a2 s.c o m*/
    out.println();
}

From source file:mx.bigdata.sat.cfdi.CFDv3.java

static void dump(String title, byte[] bytes, PrintStream out) {
    out.printf("%s: ", title);
    for (byte b : bytes) {
        out.printf("%02x ", b & 0xff);
    }//w ww  .j a  v  a 2 s . c  o  m
    out.println();
}

From source file:esiptestbed.mudrod.ontology.process.LocalOntology.java

protected static void renderHierarchy(PrintStream out, OntClass cls, List occurs, int depth) {
    renderClassDescription(out, cls, depth);
    out.println();

    // recurse to the next level down
    if (cls.canAs(OntClass.class) && !occurs.contains(cls)) {
        for (Iterator i = cls.listSubClasses(true); i.hasNext();) {
            OntClass sub = (OntClass) i.next();

            // we push this expression on the occurs list before we recurse
            occurs.add(cls);//from   w w w.  j  a v  a 2 s . co  m
            renderHierarchy(out, sub, occurs, depth + 1);
            occurs.remove(cls);
        }
        for (Iterator i = cls.listInstances(); i.hasNext();) {
            Individual individual = (Individual) i.next();
            renderURI(out, individual.getModel(), individual.getURI());
            out.print(" [");
            for (Iterator j = individual.listLabels(null); j.hasNext();) {
                out.print(((Literal) j.next()).getString() + ", ");
            }
            out.print("] ");
            out.println();
        }
    }
}

From source file:com.wandrell.example.swss.client.console.ConsoleClient.java

/**
 * Prints the client title.//from ww w  . j  a  va2s .co  m
 *
 * @param output
 *            output where the client title will be printed
 */
private static final void printTitle(final PrintStream output) {
    output.println();
    output.println("Spring WSS example console client.");
    output.println();
}

From source file:com.moss.greenshell.wizard.catastrophe.PostMortemScreen.java

public static void submitErrorReport(final Throwable cause, final ErrorReportDecorator... decorators)
        throws Exception {

    List<ErrorReportChunk> chunks = new LinkedList<ErrorReportChunk>();

    try {/*from   w  w  w.ja  v  a  2  s  . c om*/
        if (cause instanceof InternalErrorException) {
            InternalErrorException ie = (InternalErrorException) cause;
            ErrorReportChunk chunk = new ErrorReportChunk("internal-error-id", "text/plain",
                    ie.id().getBytes("UTF8"));
            chunks.add(chunk);
        } else if (cause instanceof SOAPFaultException) {
            SOAPFaultException soapFault = (SOAPFaultException) cause;
            String content = soapFault.getFault().getFirstChild().getTextContent();
            String prefix = "Internal Service Error Occurred: ";
            if (content.startsWith(prefix)) {
                String id = content.substring(prefix.length());
                ErrorReportChunk chunk = new ErrorReportChunk("internal-error-id", "text/plain",
                        id.getBytes("UTF8"));
                chunks.add(chunk);
            }
        }
    } catch (Throwable t) {
        t.printStackTrace();
    }

    // STACK TRACE
    ByteArrayOutputStream stackBytes = new ByteArrayOutputStream();
    PrintStream stackPrintStream = new PrintStream(stackBytes);
    cause.printStackTrace(stackPrintStream);
    stackPrintStream.close();
    stackBytes.close();

    ErrorReportChunk chunk = new ErrorReportChunk("stack trace", "text/plain", stackBytes.toByteArray());
    chunks.add(chunk);

    // THREAD DUMP

    ByteArrayOutputStream dumpBytes = new ByteArrayOutputStream();
    PrintStream out = new PrintStream(dumpBytes);
    Map<Thread, StackTraceElement[]> traceMap = Thread.getAllStackTraces();
    for (Map.Entry<Thread, StackTraceElement[]> next : traceMap.entrySet()) {
        out.println();
        out.println(next.getKey().getName());
        for (StackTraceElement line : next.getValue()) {
            String className = emptyIfNull(line.getClassName());
            String methodName = emptyIfNull(line.getMethodName());
            String fileName = emptyIfNull(line.getFileName());

            out.println("    " + className + "." + methodName + " (" + fileName + " line "
                    + line.getLineNumber() + ")");
        }
    }
    out.flush();
    out.close();
    ErrorReportChunk stackDump = new ErrorReportChunk("thread dump", "text/plain", dumpBytes.toByteArray());
    chunks.add(stackDump);

    // SYSTEM PROPERTIES
    ByteArrayOutputStream propsBytes = new ByteArrayOutputStream();
    PrintStream propsOut = new PrintStream(propsBytes);
    for (Map.Entry<Object, Object> next : System.getProperties().entrySet()) {
        propsOut.println(" " + next.getKey() + "=" + next.getValue());
    }
    propsOut.flush();
    propsOut.close();
    chunks.add(new ErrorReportChunk("system properties", "text/plain", propsBytes.toByteArray()));

    // LOCAL CLOCK
    chunks.add(new ErrorReportChunk("local clock", "text/plain", new DateTime().toString().getBytes()));

    // NETWORKING
    StringBuffer networking = new StringBuffer();
    Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces();
    while (ifaces.hasMoreElements()) {
        NetworkInterface iface = ifaces.nextElement();
        networking.append("INTERFACE: " + iface.getName() + " (" + iface.getDisplayName() + ")\n");
        Enumeration<InetAddress> addresses = iface.getInetAddresses();
        while (addresses.hasMoreElements()) {
            InetAddress address = addresses.nextElement();
            networking.append("  Address:" + address.getHostAddress() + "\n");
            networking.append("      Cannonical Host Name: " + address.getCanonicalHostName() + "\n");
            networking.append("                 Host Name: " + address.getHostName() + "\n");
        }
    }
    chunks.add(new ErrorReportChunk("network configuration", "text/plain", networking.toString().getBytes()));

    // DECORATORS
    if (decorators != null) {
        for (ErrorReportDecorator decorator : decorators) {
            chunks.addAll(decorator.makeChunks(cause));
        }
    }
    ErrorReport report = new ErrorReport(chunks);
    Reporter reporter = new Reporter();
    ReportId id = reporter.submitReport(report);
}

From source file:edu.cmu.cs.lti.ark.fn.utils.LemmatizeStuff.java

private static void run() throws FileNotFoundException {
    Scanner sc = new Scanner(new FileInputStream(infilename));
    PrintStream ps = new PrintStream(new FileOutputStream(outfilename));
    while (sc.hasNextLine()) {
        String line = sc.nextLine();
        ps.print(line + "\t");
        String[] toks = line.trim().split("\\s");
        int sentLen = Integer.parseInt(toks[0]);
        for (int i = 0; i < sentLen; i++) {
            String lemma = lemmatizer.getLemma(toks[i + 1].toLowerCase(), toks[i + 1 + sentLen]);
            ps.print(lemma + "\t");
        }//from w  ww .j  a  v a 2 s .  c o m
        ps.println();
    }
    sc.close();
    closeQuietly(ps);
}