Package java.util

Examples of java.util.Scanner.nextLine()


        if (!s.hasNext()) {
          return null;
        }

        while (s.hasNextLine()) {
          rows.add(new Vector<Object>(Arrays.asList(s.nextLine()
              .split("(?<!\\\\),", -1))));

        }

        if (headers == null) {
View Full Code Here


      System.out.println("Please enter a choice and press <enter>: ");
      System.out.println("\t1. Execute Sample 1 (Capitalize String)");
      System.out.println("\t2. Execute Sample 2 (Coffee Service)");
      System.out.println("\tq. Quit the application");

      final String input = scanner.nextLine();

      if("1".equals(input.trim())) {
        executeSample1();
        continue;
      } else if("2".equals(input.trim())) {
View Full Code Here

        + "\n\n Please enter a string and press <enter>: ";

    System.out.print(message);

    while (!scanner.hasNext("q")) {
      String input = scanner.nextLine();

      System.out.println("Converting String to Uppcase using Stored Procedure...");
      String inputUpperCase = service.convertToUpperCase(input);

      System.out.println("Retrieving Numeric value via Sql Function...");
View Full Code Here

    System.out.println(message);

    while (!scanner.hasNext("q")) {

      String input = scanner.nextLine();

      if ("list".equalsIgnoreCase(input)) {
        List<CoffeeBeverage> coffeeBeverages = service.findAllCoffeeBeverages();

        for (CoffeeBeverage coffeeBeverage : coffeeBeverages) {
View Full Code Here

    System.out.println("\n    Which Demo would you like to run? <enter>:\n");
    System.out.println("\t1. Channel Adapter Demo");
    System.out.println("\t2. Gateway Demo");

    while (true) {
      final String input = scanner.nextLine();

      if("1".equals(input.trim())) {
        System.out.println("    Loading Channel Adapter Demo...");
        new ClassPathXmlApplicationContext(configFilesChannelAdapterDemo, Main.class);
        break;
View Full Code Here

        StringBuilder fileContents = new StringBuilder();
        Scanner scanner = new Scanner(new File(pathname));
        String lineSeparator = System.getProperty("line.separator");
        try {
            while (scanner.hasNextLine()) {
                fileContents.append(scanner.nextLine() + lineSeparator);
            }
            return fileContents.toString();
        } finally {
            scanner.close();
        }
View Full Code Here

    private void test(File file, String... expected) throws IOException {
        List<String> actual = new ArrayList<String>();
        Scanner scanner = new Scanner(file, "UTF-8");
        while (scanner.hasNextLine()) {
            actual.add(scanner.nextLine());
        }
        scanner.close();
        Collections.sort(actual);
        Arrays.sort(expected);
        assertThat(actual, is(Arrays.asList(expected)));
View Full Code Here

    private void test(File file, String... expected) throws IOException {
        List<String> actual = new ArrayList<String>();
        Scanner scanner = new Scanner(file, "UTF-8");
        while (scanner.hasNextLine()) {
            actual.add(scanner.nextLine());
        }
        scanner.close();
        Collections.sort(actual);
        Arrays.sort(expected);
        assertThat(actual, is(Arrays.asList(expected)));
View Full Code Here

    protected List<String> collectStatements(File target) throws IOException {
        StringBuilder buf = new StringBuilder();
        Scanner scanner = new Scanner(target, "UTF-8");
        try {
            while (scanner.hasNextLine()) {
                buf.append(scanner.nextLine());
                buf.append('\n');
            }
        } finally {
            scanner.close();
        }
View Full Code Here

        try {
            InputStream output = conn.openStandardOutput();
            conn.connect();
            Scanner s = new Scanner(output, "UTF-8");
            while (s.hasNextLine()) {
                String[] pair = s.nextLine().split("=", 2);
                if (pair.length == 2) {
                    results.put(pair[0], pair[1]);
                }
            }
            s.close();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.