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:edu.wfu.inotado.WakeServMockServer.java

public void handle(Request request, Response response) {
    try {//from   ww  w  .  jav a  2  s .  c  o  m
        String signature = request.getValue("Signature");
        if (StringUtils.isNotBlank(signature)) {
            log.info("Signature received on server: " + signature);
        }
        PrintStream body = response.getPrintStream();
        response.setValue("Content-Type", "application/xml");
        body.println(this.bodyText);
        body.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.kelveden.rastajax.servlet.DefaultHtmlServlet.java

private void writeResourceMethod(FlatResourceMethod resourceMethod, PrintStream printStream) {

    printStream.println("<tr>");
    printStream.println("<td>" + resourceMethod.getRequestMethodDesignator() + "</td>");
    printStream.println("<td>" + parametersToString(resourceMethod) + "</td>");
    printStream.println("<td>" + mediaTypesToString(resourceMethod.getConsumes()) + "</td>");
    printStream.println("<td>" + mediaTypesToString(resourceMethod.getProduces()) + "</td>");
    printStream.println("</tr>");
}

From source file:com.norconex.collector.core.AbstractCollectorLauncher.java

protected CommandLine parseCommandLineArguments(String[] args) {
    Options options = new Options();
    options.addOption("c", ARG_CONFIG, true, "Required: Collector configuration file.");
    options.addOption("v", ARG_VARIABLES, true, "Optional: variable file.");
    options.addOption("a", ARG_ACTION, true, "Required: one of start|resume|stop");

    CommandLineParser parser = new DefaultParser();
    CommandLine cmd = null;/*w  ww.j  av  a 2  s.  com*/
    try {
        cmd = parser.parse(options, args);
        if (!cmd.hasOption(ARG_CONFIG) || !cmd.hasOption(ARG_ACTION) || EqualsUtil.equalsNone(
                cmd.getOptionValue(ARG_ACTION), ARG_ACTION_START, ARG_ACTION_RESUME, ARG_ACTION_STOP)) {
            HelpFormatter formatter = new HelpFormatter();
            formatter.printHelp("collector-http[.bat|.sh]", options);
            System.exit(-1);
        }
    } catch (ParseException e) {
        PrintStream err = System.err;
        err.println("Could not parse arguments.");
        e.printStackTrace(System.err);
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("collector-http[.bat|.sh]", options);
        System.exit(-1);
    }
    return cmd;
}

From source file:hudson.plugins.clearcase.changelog.UcmChangeLogSet.java

protected void printSubActivity(PrintStream stream, UcmActivity activity) {
    stream.println("\t\t<subactivity>");
    stream.println("\t\t\t<name>" + escapeXml(activity.getName()) + "</name>");
    stream.println("\t\t\t<headline>" + escapeXml(activity.getHeadline()) + "</headline>");
    stream.println("\t\t\t<stream>" + escapeXml(activity.getStream()) + "</stream>");
    stream.println("\t\t\t<user>" + escapeXml(activity.getUser()) + "</user>");
    for (UcmActivity subActivity : activity.getSubActivities()) {
        printSubActivity(stream, subActivity);
    }/*ww w. j a  v a2s  . com*/
    for (hudson.plugins.clearcase.objects.AffectedFile file : activity.getFiles()) {
        printFile(stream, file);
    }
    stream.println("\t\t</subactivity>");
}

From source file:web.GeneratedBanner.java

private void printInfoText(PrintStream out, String key, String message) {
    if (StringUtils.hasText(message)) {
        out.println(AnsiOutput.toString(GREEN, key, DEFAULT, FAINT, message));
    }/*www  .jav a 2s.c  o  m*/
}

From source file:com.hp.application.automation.tools.run.SvExportBuilder.java

@Override
protected void logConfig(PrintStream logger, String prefix) {
    logger.println(prefix + "Target Directory: " + model.getTargetDirectory());
    logger.println(prefix + "Switch to Stand-By: " + model.isSwitchToStandByFirst());
    super.logConfig(logger, prefix);
}

From source file:cc.wikitools.lucene.hadoop.ScoreWikipediaArticleHdfs.java

@SuppressWarnings("static-access")
@Override/*from w  ww.j ava  2 s  . c om*/
public int run(String[] args) throws Exception {
    Options options = new Options();
    options.addOption(
            OptionBuilder.withArgName("path").hasArg().withDescription("index location").create(INDEX_OPTION));
    options.addOption(OptionBuilder.withArgName("num").hasArg().withDescription("id").create(ID_OPTION));
    options.addOption(
            OptionBuilder.withArgName("string").hasArg().withDescription("title").create(TITLE_OPTION));
    options.addOption(
            OptionBuilder.withArgName("string").hasArg().withDescription("query text").create(QUERY_OPTION));

    CommandLine cmdline = null;
    CommandLineParser parser = new GnuParser();
    try {
        cmdline = parser.parse(options, args);
    } catch (ParseException exp) {
        System.err.println("Error parsing command line: " + exp.getMessage());
        System.exit(-1);
    }

    if (!(cmdline.hasOption(ID_OPTION) || cmdline.hasOption(TITLE_OPTION)) || !cmdline.hasOption(INDEX_OPTION)
            || !cmdline.hasOption(QUERY_OPTION)) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(ScoreWikipediaArticleHdfs.class.getName(), options);
        System.exit(-1);
    }

    String indexLocation = cmdline.getOptionValue(INDEX_OPTION);
    String queryText = cmdline.getOptionValue(QUERY_OPTION);

    HdfsWikipediaSearcher searcher = new HdfsWikipediaSearcher(new Path(indexLocation), getConf());
    PrintStream out = new PrintStream(System.out, true, "UTF-8");

    if (cmdline.hasOption(ID_OPTION)) {
        out.println("score: "
                + searcher.scoreArticle(queryText, Integer.parseInt(cmdline.getOptionValue(ID_OPTION))));
    } else {
        out.println("score: " + searcher.scoreArticle(queryText, cmdline.getOptionValue(TITLE_OPTION)));
    }

    searcher.close();
    out.close();

    return 0;
}

From source file:com.openkm.servlet.admin.UnitTestingServlet.java

/**
 * Print HTML page footer/*from ww  w  .java2  s .  c o m*/
 */
private void footer(PrintStream out) {
    out.println("</body>");
    out.println("</html>");
}

From source file:com.yahoo.storm.yarn.LaunchCommand.java

@Override
public void process(CommandLine cl) throws Exception {

    String config_file = null;//from   w  w w  . ja v a  2  s .  co m
    List remaining_args = cl.getArgList();
    if (remaining_args != null && !remaining_args.isEmpty()) {
        config_file = (String) remaining_args.get(0);
    }
    Map stormConf = Config.readStormConfig(config_file);

    String appName = cl.getOptionValue("appname", "Storm-on-Yarn");
    String queue = cl.getOptionValue("queue", "default");

    String storm_zip_location = cl.getOptionValue("stormZip");
    Integer amSize = (Integer) stormConf.get(Config.MASTER_SIZE_MB);

    StormOnYarn storm = null;
    try {
        storm = StormOnYarn.launchApplication(appName, queue, amSize, stormConf, storm_zip_location);
        LOG.debug("Submitted application's ID:" + storm.getAppId());

        //download storm.yaml file
        String storm_yaml_output = cl.getOptionValue("stormConfOutput");
        if (storm_yaml_output != null && storm_yaml_output.length() > 0) {
            //try to download storm.yaml
            StormMaster.Client client = storm.getClient();
            if (client != null)
                StormMasterCommand.downloadStormYaml(client, storm_yaml_output);
            else
                LOG.warn("No storm.yaml is downloaded");
        }

        //store appID to output
        String output = cl.getOptionValue("output");
        if (output == null)
            System.out.println(storm.getAppId());
        else {
            PrintStream os = new PrintStream(output);
            os.println(storm.getAppId());
            os.flush();
            os.close();
        }
    } finally {
        if (storm != null) {
            storm.stop();
        }
    }
}

From source file:Clases.cCifrado.java

public String pedirClave(String dato) {

    String clave = "";
    Scanner sc = new Scanner(System.in);
    Socket socket;//from   w  w  w.ja v  a 2s.co  m
    try {
        String ipServidor = receptor;
        int pto = puerto;
        System.out.println("conectando con el servidor...");
        socket = new Socket(ipServidor, pto);
        Scanner entrada = new Scanner(socket.getInputStream());
        PrintStream salidaServer = new PrintStream(socket.getOutputStream());
        salidaServer.println(dato);
        clave = entrada.nextLine();
        System.out.println("Dato recibido: " + clave);
        socket.close();

    } catch (IOException ex) {
        System.err.println("Cliente> " + ex.getMessage());
    }
    return clave;
}