Example usage for java.lang System in

List of usage examples for java.lang System in

Introduction

In this page you can find the example usage for java.lang System in.

Prototype

InputStream in

To view the source code for java.lang System in.

Click Source Link

Document

The "standard" input stream.

Usage

From source file:com.excelsiorsoft.transformer.Main.java

/**
 * Load the Spring Integration Application Context
 *
 * @param args - command line arguments//  ww  w .j  ava2 s  . c  o m
 */
public static void main(final String... args) {

    LOGGER.info("\n========================================================="
            + "\n                                                         "
            + "\n          Welcome to Spring Integration!                 "
            + "\n                                                         "
            + "\n    For more information please visit:                   "
            + "\n    http://www.springsource.org/spring-integration       "
            + "\n                                                         "
            + "\n=========================================================");

    final AbstractApplicationContext context = new ClassPathXmlApplicationContext(
            "classpath:META-INF/spring/integration/*-context.xml");

    context.registerShutdownHook();

    SpringIntegrationUtils.displayDirectories(context);

    final Scanner scanner = new Scanner(System.in);

    LOGGER.info("\n========================================================="
            + "\n                                                         "
            + "\n    Please press 'q + Enter' to quit the application.    "
            + "\n                                                         "
            + "\n=========================================================");

    while (!scanner.hasNext("q")) {
        //Do nothing unless user presses 'q' to quit.
    }

    LOGGER.info("Exiting application...bye.");

    System.exit(0);

}

From source file:com.squarespace.less.cli.LessC.java

/**
 * Main entry point for the command-line compiler.
 *///from  w ww  .j ava2 s .co  m
public static void main(String[] rawArgs) {
    System.exit(process(rawArgs, System.out, System.err, System.in));
}

From source file:com.chargebee.Application.Amountediting.java

public static void main(String[] args) throws IOException, Exception {
    Scanner sc = new Scanner(System.in);
    System.out.println("Input CSV File: ");
    String source = sc.nextLine();

    System.out.println("Input JSON File: ");
    String requirements = sc.nextLine();

    System.out.println("Output CSV File: ");
    String output = sc.nextLine();

    Amountediting ae = new Amountediting();
    JSONObject jobj = MethodBank.readJsonObjectData(requirements);
    CSVParser parser = MethodBank.parserInitializer(source);
    CSVPrinter printer = MethodBank.printerInitializer(output);

    ae.formatter(parser, printer, jobj);
    parser.close();/*from   w w w  .  ja v  a2 s.co  m*/
    printer.close();

}

From source file:com.lv.tica.Main.java

/**
 * Load the Spring Integration Application Context
 *
 * @param args - command line arguments//  w w  w. j  ava 2s . c om
 */
public static void main(final String... args) {

    LOGGER.info("\n========================================================="
            + "\n                                                         "
            + "\n          Welcome to Spring Integration!!!               "
            + "\n                                                         "
            + "\n    For more information please visit:                   "
            + "\n    http://www.springsource.org/spring-integration       "
            + "\n                                                         "
            + "\n=========================================================");

    final AbstractApplicationContext context = new ClassPathXmlApplicationContext(
            "classpath:META-INF/spring/integration/*-context.xml");

    context.registerShutdownHook();

    final Scanner scanner = new Scanner(System.in);

    final StringConversionService service = context.getBean(StringConversionService.class);

    LOGGER.info("\n========================================================="
            + "\n                                                         "
            + "\n    Please press 'q + Enter' to quit the application.    "
            + "\n                                                         "
            + "\n=========================================================");

    System.out.print("Please enter a string and press <enter>: ");

    while (true) {

        final String input = scanner.nextLine();

        if ("q".equals(input.trim())) {
            break;
        }

        try {

            System.out.println("Converted to upper-case: " + service.convertToUpperCase(input));

        } catch (Exception e) {
            LOGGER.error("An exception was caught: " + e);
        }

        System.out.print("Please enter a string and press <enter>:");

    }

    LOGGER.info("Exiting application...bye.");

    System.exit(0);

}

From source file:in.datashow.zla.Main.java

/**
 * Load the Spring Integration Application Context
 *
 * @param args - command line arguments//from   w w  w.ja  va 2 s.c o m
 */
public static void main(final String... args) {

    LOGGER.info("\n========================================================="
            + "\n                                                         "
            + "\n          Welcome to Spring Integration!                 "
            + "\n                                                         "
            + "\n    For more information please visit:                   "
            + "\n    http://www.springsource.org/spring-integration       "
            + "\n                                                         "
            + "\n=========================================================");

    final AbstractApplicationContext context = new ClassPathXmlApplicationContext(
            "classpath:META-INF/spring/integration/*-context.xml");

    context.registerShutdownHook();

    final Scanner scanner = new Scanner(System.in);

    final StringConversionService service = context.getBean(StringConversionService.class);

    LOGGER.info("\n========================================================="
            + "\n                                                         "
            + "\n    Please press 'q + Enter' to quit the application.    "
            + "\n                                                         "
            + "\n=========================================================");

    System.out.print("Please enter a string and press <enter>: ");

    while (true) {

        final String input = scanner.nextLine();

        if ("q".equals(input.trim())) {
            break;
        }

        try {

            System.out.println("Converted to upper-case: " + service.convertToUpperCase(input));

        } catch (Exception e) {
            LOGGER.error("An exception was caught: " + e);
        }

        System.out.print("Please enter a string and press <enter>:");

    }

    LOGGER.info("Exiting application...bye.");

    System.exit(0);

}

From source file:com.github.xbn.examples.regexutil.non_xbn.UserInputNumInRangeWRegex.java

public static final void main(String[] ignored) {

    int num = -1;
    boolean isNum = false;

    int iRangeMax = 2055;

    //"": Dummy string, to reuse matcher
    Matcher mtchrNumNegThrPos = Pattern.compile("-?\\b(20(5[0-5]|[0-4][0-9])|1?[0-9]{1,3})\\b").matcher("");

    do {/*from  ww  w. j  a va2 s  .c  o  m*/
        System.out.print("Enter a number between -" + iRangeMax + " and " + iRangeMax + ": ");
        String strInput = (new Scanner(System.in)).next();
        if (!NumberUtils.isNumber(strInput)) {
            System.out.println("Not a number. Try again.");
        } else if (!mtchrNumNegThrPos.reset(strInput).matches()) {
            System.out.println("Not in range. Try again.");
        } else {
            //Safe to convert
            num = Integer.parseInt(strInput);
            isNum = true;
        }
    } while (!isNum);

    System.out.println("Number: " + num);
}

From source file:com.super_bits.modulos.paginas.adminTools.PgAdminContainerObjetoTest.java

public static void main(String[] paramentros) {

    // Ask for user input
    System.out.print("Enter 1st value:");

    // use scanner to read the console input
    Scanner scan = new Scanner(System.in);
    String valor = scan.next();//from w ww  . j av a  2s  .  c om
    double valorAtualizado = Double.parseDouble(valor) * 8.333;
    double calculoMultiplo = 10 * (Math.ceil(Math.abs(valorAtualizado / 10)));

    System.out.println(calculoMultiplo);

    double teste = (double) Math.round(Double.parseDouble(valor) * 8.3d) * 10 / 10d;
    System.out.println("TEste:" + teste);

    System.out.println("Result of the operation is " + valor);

    System.out.println(Precision.round(0.912385, 0, BigDecimal.ROUND_HALF_UP));
    int yourScale = 10;
    System.out.println(BigDecimal.valueOf(0.42344534534553453453 - 0.42324534524553453453).setScale(yourScale,
            BigDecimal.ROUND_HALF_UP));
}

From source file:test.node.TestUnboudedJobRunner.java

public static void main(String[] args) {
    // Test Job//from  w w w  .  j  a v  a2s .c om
    TestUnboundedJob testJob = new TestUnboundedJob();

    try {

        log.info("GridNode Starting...");
        StopWatch sw = new StopWatch();
        sw.start();

        GridNode node = Grid.startGridNode();

        log.info("GridNode ID : " + node.getId());

        sw.stop();

        log.info("GridNode Started Up. [" + sw.getLastTaskTimeMillis() + " ms]");

        // Submit Job
        log.debug("Submitting Job");

        sw.start();

        GridJobFuture future = node.getJobSubmissionService().submitJob(testJob, new ResultCallback() {

            public void onResult(Serializable result) {
                System.err.println(result);
            }

        });

        while (!future.isJobFinished()) {
            Thread.sleep(1000);
        }

        sw.stop();
        log.info("GridJob Finished. Duration " + sw.getLastTaskTimeMillis() + " ms");

        log.debug("Press any key to unregister GridNode and terminate");
        System.in.read();
        node.getNodeRegistrationService().unregister();

        log.info("Unregistered, Terminating...");
        System.exit(0);

    } catch (IOException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:jshm.util.Crypto.java

public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    String in = s.nextLine();/*from w ww  .j a  va  2 s  .  c o m*/

    System.out.println(args.length > 0 && args[0].toLowerCase().startsWith("d") ? decrypt(in) : encrypt(in));
}

From source file:CatFile.java

public static void main(String[] av) {
    CatFile c = new CatFile();
    if (av.length == 0)
        c.process(new BufferedReader(new InputStreamReader(System.in)));
    else//from ww  w .jav a 2  s  . c  o  m
        for (int i = 0; i < av.length; i++)
            try {
                c.process(new BufferedReader(new FileReader(av[i])));
            } catch (FileNotFoundException e) {
                System.err.println(e);
            }
}