Code example for StreamTokenizer

Methods: nextToken, slashSlashComments

0
     * @tests java.io.StreamTokenizer#slashSlashComments(boolean) 
     */ 
    public void test_slashSlashComments_withSSOpen() throws IOException { 
        Reader reader = new CharArrayReader( "t // t t t".toCharArray());
 
        StreamTokenizer st = new StreamTokenizer(reader);
        st.slashSlashComments(true);
 
        assertEquals(StreamTokenizer.TT_WORD,st.nextToken());
        assertEquals(StreamTokenizer.TT_EOF,st.nextToken());
    } 
 
    /** 
     * @tests java.io.StreamTokenizer#slashSlashComments(boolean) 
     */ 
    public void test_slashSlashComments_withSSOpen_NoComment() throws IOException { 
        Reader reader = new CharArrayReader( "// t".toCharArray());
 
        StreamTokenizer st = new StreamTokenizer(reader);
        st.slashSlashComments(true);
        st.ordinaryChar('/');