Code example for StringTokenizer

Methods: hasMoreTokens, nextToken

0
    String line = lines.readLine();
    if (line == null) {
      throw new IOException( "Expecting a line not the end of stream" );
    } 
    StringTokenizer tokens =
      new StringTokenizer(line, " \t\n\r\f%");
     
    this.filesystem = tokens.nextToken();
    if (!tokens.hasMoreTokens()) {            // for long filesystem name
      line = lines.readLine();
      if (line == null) {
        throw new IOException( "Expecting a line not the end of stream" );
      } 
      tokens = new StringTokenizer(line, " \t\n\r\f%");
    } 
    Long.parseLong(tokens.nextToken()); // skip capacity
    Long.parseLong(tokens.nextToken()); // skip used
    Long.parseLong(tokens.nextToken()); // skip available
    Integer.parseInt(tokens.nextToken()); // skip percentUsed
    this.mount = tokens.nextToken();
  } 
 
  public static void main(String[] args) throws Exception {
    String path = ".";
    if (args.length > 0)