Code example for StringTokenizer

Methods: hasMoreElements, nextToken

0
    private static POP3MessageInfo __parseStatus(String line)
    { 
        int num, size;
        StringTokenizer tokenizer;
 
        tokenizer = new StringTokenizer(line);
 
        if (!tokenizer.hasMoreElements()) {
            return null; 
        } 
 
        num = size = 0;
 
        try 
        { 
            num = Integer.parseInt(tokenizer.nextToken());
 
            if (!tokenizer.hasMoreElements()) {
                return null; 
            } 
 
            size = Integer.parseInt(tokenizer.nextToken());
        } 
        catch (NumberFormatException e)
        { 
            return null; 
        }