Package java.util

Examples of java.util.Scanner.useDelimiter()


  }
  */
  private void doParse(String regex){
    Scanner scanner = new Scanner(parseString.trim());   
    if(regex != null){
      scanner = scanner.useDelimiter(regex);
    }
    while(scanner.hasNext()){
      String tagTerm = getNextTagTerm(scanner);
      logger.debug("tagTerm="+tagTerm);
      if(tagTerm.contains(":") == true){     
View Full Code Here


   * @return a list of file
   */
  public static List<File> textURIListToFileList(String data) {
    List<File> retVal = new java.util.ArrayList<File>(1);
    Scanner scanner = new Scanner(data);
    scanner.useDelimiter(URI_DELIMITER);
    while (scanner.hasNext()) {
      String token = scanner.next();
      if (token != null && !token.startsWith("#")) {
        try {
          File currentFile = new File(new URI(token));
View Full Code Here

    for (Resource res : resources) {
      File file = res.getFile();
      if (file.getName().endsWith("Appmaster.stderr") && file.length() > 0) {
        Scanner scanner = new Scanner(file);
        masterFailReason.append("[Appmaster.stderr=");
        masterFailReason.append(scanner.useDelimiter("\\A").next());
        masterFailReason.append("]");
        scanner.close();
        break;
      }
    }
View Full Code Here

        assertThat(file.length(), greaterThan(0l));
      } else if (file.getName().endsWith("stderr")) {
        String content = "";
        if (file.length() > 0) {
          Scanner scanner = new Scanner(file);
          content = scanner.useDelimiter("\\A").next();
          scanner.close();
        }
        if (content.contains("Unable to load realm info from SCDynamicStore")) {
          // due to OS X giving 'Unable to load realm info from SCDynamicStore' errors we allow 100 bytes here
          assertThat(file.length(), lessThan(100l));
View Full Code Here

      if (file.getName().endsWith("stdout")) {
        // there has to be some content in stdout file
        assertThat("there has to be content in stdout file", file.length(), greaterThan(0l));
        if (file.getName().equals("Container.stdout")) {
          Scanner scanner = new Scanner(file);
          String content = scanner.useDelimiter("\\A").next();
          scanner.close();
          // check that we have a simple timestamp
          assertThat("content doesn't look like timestamp", content.length(), greaterThan(10));
          assertThat("content doesn't look like timestamp", content.length(), lessThan(40));
        }
View Full Code Here

        }
      } else if (file.getName().endsWith("stderr")) {
        String content = "";
        if (file.length() > 0) {
          Scanner scanner = new Scanner(file);
          content = scanner.useDelimiter("\\A").next();
          scanner.close();
        }
        if (content.contains("Unable to load realm info from SCDynamicStore")) {
          // due to OS X giving 'Unable to load realm info from SCDynamicStore' errors we allow 100 bytes here
          assertThat("stderr file is not empty: " + content, file.length(), lessThan(100l));
View Full Code Here

        cache.clear();
        Scanner scanner = null;
        try {
            scanner = new Scanner(fileStore);
            scanner.useDelimiter(STORE_DELIMITER);
            while (scanner.hasNextLine()) {
                String line = scanner.nextLine();
                cache.put(line, line);
            }
        } catch (IOException e) {
View Full Code Here

  public List<Influenza_N_P_CR_Element> processFile(String fileName, ProteinCache cacheImpl) {
    List<Influenza_N_P_CR_Element> outList =  new ArrayList<Influenza_N_P_CR_Element>();
    System.out.println("Processing Influenza file " + fileName);
    try {
      Scanner scanner = new Scanner(new File(fileName.trim()));
      scanner.useDelimiter(SecurityActions.getProperty("line.separator"));
      while (scanner.hasNext()) {

        Influenza_N_P_CR_Element x = parseLine(scanner.next());
        outList.add(x);
      }
View Full Code Here

  private static Influenza_N_P_CR_Element parseLine(String line) {
    Influenza_N_P_CR_Element currRec = new Influenza_N_P_CR_Element();

    Scanner lineScanner = new Scanner(line);
    lineScanner.useDelimiter("\t");
    while (lineScanner.hasNext()) {
      try {
        currRec.setGanNucleoid(lineScanner.next());
        try {
          while (true) {
View Full Code Here

    {
        // See <weblogs.java.net/blog/pat/archive/2004/10/stupid_scanner_1.html>
        Scanner scanner = new Scanner(is, "UTF-8");
        try
        {
            scanner.useDelimiter("\\A");

            return scanner.hasNext() ? scanner.next() : null;
        }
        finally
        {
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.