Code example for StreamTokenizer

Methods: nextTokenpushBack

0
     * @throws ParseException 
     * @throws IOException 
     */ 
    private double parseDouble(StreamTokenizer tokenizer, String valueName) throws ParseException,
                                                                                   IOException { 
        int tt = tokenizer.nextToken();
        if (tt != StreamTokenizer.TT_NUMBER) {
            tokenizer.pushBack();
            fail(valueName + " expected");
        } 
        double result = tokenizer.nval;
        tt = tokenizer.nextToken();
        if (tt == StreamTokenizer.TT_WORD &&
            (tokenizer.sval.startsWith("e") || tokenizer.sval.startsWith("E"))) {
            result = new Double(result + tokenizer.sval).doubleValue();
        } else { 
            tokenizer.pushBack();
        } 
        return result;
    } 
 
    private void parseListStart(int tt) throws ParseException {