Package java.util

Examples of java.util.Scanner.useDelimiter()


  public static ModelContainer modelContainerFromFile(
    final String path
  ) throws FileNotFoundException {
    FileInputStream file = new FileInputStream(path);
    Scanner fileScanner = new Scanner(file, "UTF-8");
    String json = fileScanner.useDelimiter("\\A").next();
    fileScanner.close();

    return modelContainerFromJson(json);
  }
View Full Code Here


                    // -> bean=bar?method=great(a,b)
                    // http://stackoverflow.com/questions/1516090/splitting-a-title-into-separate-parts
                    delimiter = ",(?!(?:[^\\(,]|[^\\)],[^\\)])+\\))";
                }

                scanner.useDelimiter(delimiter);
                return CastUtils.cast(scanner);
            } else {
                // use a plain iterator that returns the value as is as there are only a single value
                return CastUtils.cast(new Iterator<String>() {
                    int idx = -1;
View Full Code Here

            // this code is optimized to only use a Scanner if needed, eg there is a delimiter

            if (delimiter != null && s.contains(delimiter)) {
                // use a scanner if it contains the delimiter
                Scanner scanner = new Scanner((String)value);
                scanner.useDelimiter(delimiter);
                return CastUtils.cast(scanner);
            } else {
                // use a plain iterator that returns the value as is as there are only a single value
                return CastUtils.cast(new Iterator<String>() {
                    int idx = -1;
View Full Code Here

      scanner = new Scanner(ffile);

      while (scanner.hasNextLine()) {
        String strLine = scanner.nextLine();
        Scanner scanner2 = new Scanner(strLine);
        scanner2.useDelimiter("=");
        if (scanner2.hasNext()) {
          String token = scanner2.next();

          if (token.equals("modsFilePath") && scanner2.hasNext())
            modsFilePath = new String(scanner2.next());
View Full Code Here

      while (scanner.hasNextLine()) {
        String strLine = scanner.nextLine();
        if (strLine.contains("RaidPresence:")) {
          Scanner scanner2 = new Scanner(strLine);
          scanner2.useDelimiter(" ");
          String nom = "";
          while (scanner2.hasNext()) {
            String token = scanner2.next();
            if (token.equals("NOM")) {
              if (scanner2.hasNext()) {
View Full Code Here

      scanner = new Scanner(ffile);
      while (scanner.hasNextLine()) {
        String strLine = scanner.nextLine();
        if (strLine.contains("TaxRecordAddon:")) {
          Scanner scanner2 = new Scanner(strLine);
          scanner2.useDelimiter(" ");
          String nom = "";
          Long val = null;
          java.util.Date date = null;
          while (scanner2.hasNext()) {
            String token = scanner2.next();
View Full Code Here

        model.setRowCount(0);

        String ex = Shared.getConfig("banks");
        String allConcepts = ex.substring(1, ex.length()-1);
        Scanner sc = new Scanner(allConcepts);
        sc.useDelimiter("\\}\\{");

        JComboBox jcb = new JComboBox();
        while(sc.hasNext()){
            jcb.addItem(sc.next());
        }
View Full Code Here

        model.setRowCount(0);

        String ex = Shared.getConfig("expenses");
        String allConcepts = ex.substring(1, ex.length()-1);
        Scanner sc = new Scanner(allConcepts);
        sc.useDelimiter("\\}\\{");

        JComboBox jcb = new JComboBox();
        while(sc.hasNext()){
            jcb.addItem(sc.next());
        }
View Full Code Here

    InputStream inputStream = new FileInputStream(xmlFile);
    Scanner scanner = new Scanner(inputStream, "UTF-8");
    String expected = "";
    try {
      expected = scanner.useDelimiter("\\Z").next().trim();
    } finally {
      scanner.close();
    }

    Assert.assertEquals(actual, expected);
View Full Code Here

            if (response.getBody() != null) {
                sb.append("\nBody: ");
                try {
                    Scanner s = new Scanner(response.getBody().in());
                    s.useDelimiter("\\A");
                    sb.append(s.hasNext() ? s.next() : "");
                    s.close();
                } catch (IOException e) {
                    sb.append("Error parsing body");
                }
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.