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.aliyun.openservices.odps.console.mr.MapReduceCommand.java

public static void printUsage(PrintStream out) {
    out.println("");
    out.println("Usage: jar [<genericOptions>] <mainClass> args...;");
    out.println("");
    out.println("Generic options supported are");
    out.println("    -conf <configuration file>         application configuration file");
    out.println(/*from   www. j  a va  2s  .  c  o  m*/
            "    -resources <resource_name_list>    file/archive/table resources used in mapper or reducer");
    out.println("    -libjars <rsource_name_list>       jar resources used in mapper or reducer");
    out.println("    -classpath <local_file_list>       classpaths used to run mainClass");
    out.println("    -l                                 run job in local mode");
    out.println(
            "    -D<prop_name>=<prop_value>         property value pair, which will be used to run mainClass");
    out.println("For example:");
    out.println(
            "    jar -conf /home/admin/myconf -resources a.txt -libjars example.jar -classpath ../lib/example.jar:./other_lib.jar -Djava.library.path=./native -Xmx512M mycompany.WordCount -m 10 -r 10 in out;");
    out.println("");
}

From source file:cz.pecina.bin.bitwriter.BitWriter.java

/**
 * Main processing method./*from w w  w.  j av a 2s  . com*/
 *
 * @param  args   command-line arguments
 * @param  stdin  console input stream
 * @param  stdout console output stream
 * @param  stderr console error stream
 * @return        the exit code
 */
public static int process(final String args[], final InputStream stdin, final PrintStream stdout,
        final PrintStream stderr) {
    log.fine("Processing started");

    try {
        new BitWriter(args, stdin, stdout, stderr);
    } catch (final ParametersException exception) {
        stderr.println("Error in parameters: " + exception.getMessage());
        Parameters.usage(stderr);
        log.fine("Processing terminated abnormally, exception: " + exception.getMessage());
        return Constants.EXIT_CODE_ERROR_IN_PARAMETERS;
    } catch (final PresetCrcModelsException exception) {
        stderr.println("Error in CRC models file: " + exception.getMessage());
        log.fine("Processing terminated abnormally, exception: " + exception.getMessage());
        return Constants.EXIT_CODE_ERROR_IN_PRESET_CRC_MODELS;
    } catch (final ProcessorException exception) {
        stderr.println("Processing error: " + exception.getMessage());
        log.fine("Processing terminated abnormally, exception: " + exception.getMessage());
        return Constants.EXIT_CODE_PROCESSING_ERROR;
    } catch (final IOException exception) {
        stderr.println("I/O error: " + exception.getMessage());
        log.fine("Processing terminated abnormally, exception: " + exception.getMessage());
        return Constants.EXIT_CODE_IO_ERROR;
    }

    log.fine("Processing terminated normally");
    return Constants.EXIT_CODE_SUCCESS;
}

From source file:com.chinamobile.bcbsp.util.ClassLoaderUtil.java

/**
 * Prints class path list.//w  ww .j  ava2 s.  co m
 *
 * @param ps A PrintStream to another output stream.
 * @param classPath The path list of URLs for loading classes and resources.
 */
private static void list(PrintStream ps, URL[] classPath) {
    for (int i = 0; i < classPath.length; i++) {
        ps.println(classPath[i]);
    }
}

From source file:org.alfresco.extension.scripting.javascript.JavascriptHelper.java

public static void help(final Context context, final Scriptable thisObj, final Object[] args, Function funObj) {
    logger.debug("help");
    PrintStream out = ((Global) funObj.getParentScope()).getOut();
    Global.help(context, thisObj, args, funObj);
    out.println(getMessage("msg.help", null));
}

From source file:edu.msu.cme.rdp.graph.utils.BloomFilterStats.java

public static void printStats(BloomFilter filter, PrintStream out) {

    long n = filter.getUniqueKmers();
    long m = (long) Math.pow(2, filter.getHashSizeLog2());
    int k = filter.getHashCount();

    //(1-e^(-k*((n+.5)/(m-1))))^k
    double falsePositiveRate = Math.pow((1 - Math.pow(Math.E, -k * ((n + .5) / (m - 1)))), k);

    out.println("Bloom filter created on:       " + filter.getCreatedOn());
    out.println("Serializable id:               " + BloomFilter.serialVersionUID);
    out.println();/* w  ww .j av  a 2  s.  c  om*/
    out.println("Bloom filter size log 2:       " + filter.getHashSizeLog2());
    out.println("Bloom filter size (bits) (m):  " + m);
    out.println();
    out.println("Number of bitsets:             " + filter.getNumBitsets());
    out.println("Bitset size (bits):            " + filter.getBitsetSize());
    out.println("Bitset size log2:              " + filter.getBitsetSizeLog2());
    out.println();
    out.println("Number of hashes (k):          " + filter.getHashCount());
    out.println("Hash function name:            " + filter.getHasherClassName());
    out.println();
    out.println("Bitset Mask:                   "
            + StringUtils.leftPad(Long.toBinaryString(filter.getBitsetMask()), 64, '0'));
    out.println("Hash mask:                     "
            + StringUtils.leftPad(Long.toBinaryString(filter.getHashMask()), 64, '0'));
    out.println();
    out.println("Kmer length:                   " + filter.getKmerSize());
    out.println();
    out.println("Total kmers in bloom filter:   " + filter.getTotalKmers());
    out.println("Total strings inserted:        " + filter.getTotalStrings());
    out.println("Total unique kmers:            " + filter.getUniqueKmers());
    if (filter.getSingltonKmers() > -1) {
        out.println("Total mercy kmers if set:      " + filter.getMercyKmers());
        out.println("Total singleton kmers:         " + filter.getSingltonKmers());
    }
    out.println("Predicted false positive rate: " + falsePositiveRate);
}

From source file:de.tudarmstadt.ukp.dkpro.argumentation.io.writer.ArgumentDumpWriter.java

/**
 * Dump argument components to String. Can be also used outside UIMA pipeline.
 *
 * @param jCas jcas//from   w  w w .ja v  a  2  s  .  co  m
 * @return string dump
 */
public static String dumpArguments(JCas jCas, boolean includeProperties, boolean includeRelations) {
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    PrintStream out = new PrintStream(outputStream);

    String documentId = DocumentMetaData.get(jCas).getDocumentId();

    out.println("======== #" + documentId + " begin ==========================");

    Collection<ArgumentComponent> argumentComponents = JCasUtil.select(jCas, ArgumentComponent.class);

    out.println("----------------- ArgumentComponent -----------------");
    out.println("# of argument units: " + argumentComponents.size());

    for (ArgumentComponent argumentComponent : argumentComponents) {
        out.println(argumentUnitToString(argumentComponent));

        if (includeProperties) {
            out.println(formatProperties(argumentComponent));
        }

        if (argumentComponent instanceof Claim) {
            Claim claim = (Claim) argumentComponent;
            String stance = claim.getStance();

            if (stance != null) {
                out.println("Stance: " + stance);
            }
        }
    }

    Collection<ArgumentRelation> argumentRelations = JCasUtil.select(jCas, ArgumentRelation.class);

    if (includeRelations) {
        out.println("----------------- ArgumentRelation -----------------");
        out.println("# of argument relations: " + argumentRelations.size());

        for (ArgumentRelation argumentRelation : argumentRelations) {
            out.println(argumentRelation.getType().getShortName());
            out.println("   source: " + argumentUnitToString(argumentRelation.getSource()));
            out.println("   target: " + argumentUnitToString(argumentRelation.getTarget()));

            if (includeProperties) {
                out.println(formatProperties(argumentRelation));
            }
        }
    }

    out.println("======== #" + documentId + " end ==========================");

    try {
        return outputStream.toString("utf-8");
    } catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e);
    }
}

From source file:edu.msu.cme.rdp.graph.sandbox.BloomFilterInterrogator.java

public static void printStats(BloomFilter filter, PrintStream out) {

    long n = filter.getUniqueKmers();
    long m = (long) Math.pow(2, filter.getHashSizeLog2());
    int k = filter.getHashCount();

    //(1-e^(-k*((n+.5)/(m-1))))^k
    double falsePositiveRate = Math.pow((1 - Math.pow(Math.E, -k * ((n + .5) / (m - 1)))), k);

    out.println("Bloom filter created on:       " + filter.getCreatedOn());
    out.println("Serializable id:               " + BloomFilter.serialVersionUID);
    out.println();/* www  . ja  v  a2 s . c o m*/
    out.println("Bloom filter size log 2:       " + filter.getHashSizeLog2());
    out.println("Bloom filter size (bits) (m):  " + m);
    out.println();
    out.println("Number of bitsets:             " + filter.getNumBitsets());
    out.println("Bitset size (bits):            " + filter.getBitsetSize());
    out.println("Bitset size log2:              " + filter.getBitsetSizeLog2());
    out.println();
    out.println("Number of hashes (k):          " + filter.getHashCount());
    out.println("Hash function name:            " + filter.getHasherClassName());
    out.println();
    out.println("Bitset Mask:                   "
            + StringUtils.leftPad(Long.toBinaryString(filter.getBitsetMask()), 64, '0'));
    out.println("Hash mask:                     "
            + StringUtils.leftPad(Long.toBinaryString(filter.getHashMask()), 64, '0'));
    out.println();
    out.println("Kmer length:                   " + filter.getKmerSize());
    out.println();
    out.println("Total kmers in bloom filter:   " + filter.getTotalKmers());
    out.println("Total strings inserted:        " + filter.getTotalStrings());
    out.println("Total unique kmers:            " + filter.getUniqueKmers());
    out.println("Predicted false positive rate: " + falsePositiveRate);
}

From source file:hudson.plugins.clearcase.ClearCaseChangeLogSet.java

/**
 * Stores the history objects to the output stream as xml
 * /*from   w  ww.j  a  v  a2s  .c o  m*/
 * @param outputStream the stream to write to
 * @param history the history objects to store
 * @throws IOException
 */
public static void saveToChangeLog(OutputStream outputStream, List<ClearCaseChangeLogEntry> history)
        throws IOException {
    PrintStream stream = new PrintStream(outputStream, false, "UTF-8");

    int tagcount = ClearCaseChangeLogSet.TAGS.length;
    stream.println("<?xml version='1.0' encoding='UTF-8'?>");
    stream.println("<history>");
    for (ClearCaseChangeLogEntry entry : history) {
        stream.println("\t<entry>");
        String[] strings = getEntryAsStrings(entry);
        for (int tag = 0; tag < tagcount; tag++) {
            stream.print("\t\t<");
            stream.print(ClearCaseChangeLogSet.TAGS[tag]);
            stream.print('>');
            stream.print(escapeForXml(strings[tag]));
            stream.print("</");
            stream.print(ClearCaseChangeLogSet.TAGS[tag]);
            stream.println('>');
        }
        for (ClearCaseChangeLogEntry.FileElement file : entry.getElements()) {
            stream.println("\t\t<element>");
            stream.println("\t\t\t<file>");
            stream.println(escapeForXml(file.getFile()));
            stream.println("\t\t\t</file>");
            stream.println("\t\t\t<action>");
            stream.println(escapeForXml(file.getAction()));
            stream.println("\t\t\t</action>");
            stream.println("\t\t\t<version>");
            stream.println(escapeForXml(file.getVersion()));
            stream.println("\t\t\t</version>");
            stream.println("\t\t\t<operation>");
            stream.println(escapeForXml(file.getOperation()));
            stream.println("\t\t\t</operation>");
            stream.println("\t\t</element>");
        }
        stream.println("\t</entry>");
    }
    stream.println("</history>");
    stream.close();
}

From source file:com.jaeksoft.searchlib.Logging.java

private final static boolean noLogger(PrintStream ps, Object msg, Throwable e) {
    if (logger != null)
        return false;
    if (msg != null)
        ps.println(msg);
    if (e != null && isShowStackTrace())
        e.printStackTrace();//  w w w. ja va2s  . com
    return true;
}

From source file:fr.jetoile.hadoopunit.HadoopUtils.java

public static void printBanner(PrintStream out) {
    try {//from  www  . j av a  2  s .  c  o  m
        InputStream banner = HadoopUtils.class.getResourceAsStream("/banner.txt");

        BufferedReader br = new BufferedReader(new InputStreamReader(banner));
        String line = null;
        while ((line = br.readLine()) != null) {
            out.println(line);
        }
    } catch (Exception ex) {
        LOG.warn("Banner not printable", ex);
    }
}