Search in sources :

Example 6 with StringTokenizer

use of java.util.StringTokenizer in project hadoop by apache.

the class TestLocalFileSystemPermission method getGroups.

static List<String> getGroups() throws IOException {
    List<String> a = new ArrayList<>();
    String s = Shell.execCommand(Shell.getGroupsCommand());
    StringTokenizer t = new StringTokenizer(s);
    while (t.hasMoreTokens()) {
        a.add(t.nextToken());
    }
    return a;
}
Also used : StringTokenizer(java.util.StringTokenizer) ArrayList(java.util.ArrayList)

Example 7 with StringTokenizer

use of java.util.StringTokenizer in project hadoop by apache.

the class ExactLineComparator method compare.

@Override
public boolean compare(String actual, String expected) {
    boolean success = false;
    StringTokenizer tokenizer = new StringTokenizer(actual, "\n\r");
    while (tokenizer.hasMoreTokens() && !success) {
        String actualToken = tokenizer.nextToken();
        success = actualToken.equals(expected);
    }
    return success;
}
Also used : StringTokenizer(java.util.StringTokenizer)

Example 8 with StringTokenizer

use of java.util.StringTokenizer in project hadoop by apache.

the class StringUtils method getStringCollection.

/**
   * Returns a collection of strings.
   * 
   * @param str
   *          String to parse
   * @param delim
   *          delimiter to separate the values
   * @return Collection of parsed elements.
   */
public static Collection<String> getStringCollection(String str, String delim) {
    List<String> values = new ArrayList<String>();
    if (str == null)
        return values;
    StringTokenizer tokenizer = new StringTokenizer(str, delim);
    while (tokenizer.hasMoreTokens()) {
        values.add(tokenizer.nextToken());
    }
    return values;
}
Also used : StringTokenizer(java.util.StringTokenizer) ArrayList(java.util.ArrayList)

Example 9 with StringTokenizer

use of java.util.StringTokenizer in project hadoop by apache.

the class FileContextPermissionBase method getGroups.

static List<String> getGroups() throws IOException {
    List<String> a = new ArrayList<String>();
    String s = Shell.execCommand(Shell.getGroupsCommand());
    for (StringTokenizer t = new StringTokenizer(s); t.hasMoreTokens(); ) {
        a.add(t.nextToken());
    }
    return a;
}
Also used : StringTokenizer(java.util.StringTokenizer) ArrayList(java.util.ArrayList)

Example 10 with StringTokenizer

use of java.util.StringTokenizer in project groovy by apache.

the class SimpleGroovyPackageDoc method getRelativeRootPath.

public String getRelativeRootPath() {
    StringTokenizer tokenizer = new StringTokenizer(name(), "" + FS);
    StringBuilder sb = new StringBuilder();
    while (tokenizer.hasMoreTokens()) {
        tokenizer.nextToken();
        sb.append("../");
    }
    return sb.toString();
}
Also used : StringTokenizer(java.util.StringTokenizer)

Aggregations

StringTokenizer (java.util.StringTokenizer)2182 ArrayList (java.util.ArrayList)430 IOException (java.io.IOException)219 HashSet (java.util.HashSet)137 HashMap (java.util.HashMap)135 File (java.io.File)108 Map (java.util.Map)92 Set (java.util.Set)88 BufferedReader (java.io.BufferedReader)87 Iterator (java.util.Iterator)80 ParseResult (pcgen.rules.persistence.token.ParseResult)68 List (java.util.List)65 InputStreamReader (java.io.InputStreamReader)50 URL (java.net.URL)48 NoSuchElementException (java.util.NoSuchElementException)43 FileReader (java.io.FileReader)40 CDOMReference (pcgen.cdom.base.CDOMReference)40 Vector (java.util.Vector)39 Properties (java.util.Properties)36 Prerequisite (pcgen.core.prereq.Prerequisite)36