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:com.wandrell.example.swss.client.console.ConsoleClient.java

/**
 * Waits until the 'enter' key is pressed.
 *
 * @param output/* w ww.ja v a  2  s .  c o m*/
 *            output where the information will be printed
 * @param scanner
 *            scanner for reading the input
 */
private static final void waitForEnter(final PrintStream output, final Scanner scanner) {

    output.println();
    // The scanner is cleaned to remove any new line
    if (scanner.hasNextLine()) {
        scanner.nextLine();
    }

    output.println("Press Enter to continue.");
    scanner.nextLine();
}

From source file:au.com.jwatmuff.eventmanager.export.CSVExporter.java

private static void outputRow(Object[] fields, PrintStream out) {
    boolean first = true;
    for (Object field : fields) {
        if (!first)
            out.print(",");
        if (field != null) {
            if (field instanceof Number) {
                out.print(field);/*from w  ww.j  av a2  s.  c o m*/
            } else {
                out.print("\"" + field + "\"");
            }
        }
        first = false;
    }
    out.println();
}

From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.util.Timing.java

/**
 * Prints the relative magnitudes of the collected timer data to the
 * specified {@link PrintStream}.//from  ww  w .  ja  v a2  s .  co m
 * 
 * @param out the stream to which data is printed
 */
public static void printMagnitudes(PrintStream out) {
    double min = Double.POSITIVE_INFINITY;

    for (Map.Entry<String, SummaryStatistics> entry : data.entrySet()) {
        min = Math.min(min, entry.getValue().getMean());
    }

    for (Map.Entry<String, SummaryStatistics> entry : data.entrySet()) {
        out.print(entry.getKey());
        out.print(": ");
        out.print(entry.getValue().getMean() / min);
        out.println();
    }
}

From source file:edu.umn.cs.sthadoop.hdfs.KNNJoin.java

static <S extends Shape> void write(Text text, Path outputPath) throws IOException {
    if (outputPath != null) {
        PrintStream ps = new PrintStream(new FileOutputStream(outputPath.toString(), true));
        ps.print(text);//w w  w  .j a va 2 s  .  c o  m
        ps.println();
        ps.close();
    }
}

From source file:com.xylocore.copybook.runtime.internal.AbstractCopybookGenerator.java

private static void generateDelegationSectionSeparator(PrintStream aOutputStream) {
    aOutputStream.println();
    aOutputStream.println();//  ww  w.  ja  v a 2 s.com
    aOutputStream.println();
    aOutputStream.println();
}

From source file:com.splicemachine.homeless.TestUtils.java

public static int printResult(String statement, ResultSet rs, PrintStream out) throws SQLException {
    if (rs.isClosed()) {
        return 0;
    }/*  w w w.  j  av  a2 s.c  om*/
    int resultSetSize = 0;
    out.println();
    out.println(statement);
    List<Map> maps = TestUtils.resultSetToOrderedMaps(rs);
    if (maps.size() > 0) {
        List<String> keys = new ArrayList<String>(maps.get(0).keySet());
        for (String col : keys) {
            out.print(" " + col + " |");
        }
        out.println();
        for (int i = 0; i < keys.size(); ++i) {
            out.print("-----");
        }
        out.println();
        for (Map map : maps) {
            ++resultSetSize;
            for (String key : keys) {
                out.print(" " + map.get(key) + " |");
            }
            out.println();
        }
    }
    out.println("--------------------");
    out.println(resultSetSize + " rows");
    return resultSetSize;
}

From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.util.Timing.java

/**
 * Prints the collected timer data to the specified {@link PrintStream}.
 * /*from   w w  w  . ja v  a  2s . c  o m*/
 * @param out the stream to which data is printed
 */
public static void printStatistics(PrintStream out) {
    for (Map.Entry<String, SummaryStatistics> entry : data.entrySet()) {
        out.print(entry.getKey());
        out.print(": ");
        out.print(entry.getValue().getMin() / 1000000000.0);
        out.print(' ');
        out.print(entry.getValue().getMean() / 1000000000.0);
        out.print(' ');
        out.print(entry.getValue().getMax() / 1000000000.0);
        out.print(' ');
        out.print(entry.getValue().getN());
        out.println();
    }
}

From source file:au.com.jwatmuff.eventmanager.export.CSVExporter.java

public static void generateResults(Database database, ResultInfoCache cache, OutputStream out) {
    PrintStream ps = new PrintStream(out);

    for (Result result : database.findAll(Result.class, ResultDAO.ALL)) {
        try {/*from  ww  w.j  a v a2s  . c  om*/
            ResultInfo ri = cache.getResultInfo(result.getID());
            ps.print("\"" + ri.getMatName() + "\",");
            ps.print(ri.getMatFightNumber() + ",");
            ps.print("\"" + ri.getPlayerName()[0] + "\",");
            ps.print("\"" + ri.getPlayerName()[1] + "\",");
            ps.print(ri.getResult().getScores()[0] + ",");
            ps.print(ri.getResult().getScores()[1]);

            ps.println();
        } catch (DatabaseStateException e) {
            // do nothing
        }
    }
}

From source file:fr.cs.examples.bodies.DEFile.java

private static void displayUsage(final PrintStream stream) {
    stream.print("usage: java DEFile");
    stream.print(" -in filename");
    stream.print(" [-help]");
    stream.print(" [-constant name]");
    stream.print(" [-all-constants]");
    stream.print(" [-start date]");
    stream.print(" [-end date]");
    stream.print(" [-out filename]");
    stream.println();
}

From source file:com.xylocore.copybook.runtime.internal.AbstractCopybookGenerator.java

private static void generateIsValidMethod(PrintStream aOutputStream, String aModifiers, String aMethodName,
        String aDelegateMethodPrefix, List<Parameter> aParameters, int aLinesBefore, int aLinesAfter) {
    for (int i = 0; i < aLinesBefore; i++) {
        aOutputStream.println();
    }/* ww  w .  j  a  v  a2 s.  co m*/

    generateMethodHeader(aOutputStream, aModifiers, aMethodName, "boolean", aParameters);

    aOutputStream.println("    {");

    generateDelegateMethodCall(aOutputStream, "return " + aDelegateMethodPrefix, aParameters);

    aOutputStream.println("    }");

    for (int i = 0; i < aLinesAfter; i++) {
        aOutputStream.println();
    }
}