Code example for StreamTokenizer

Methods: nextToken, ordinaryChar, slashSlashComments

0
     * @tests java.io.StreamTokenizer#slashSlashComments(boolean) 
     */ 
    public void test_slashSlashComments_withSSClosed() throws IOException { 
        Reader reader = new CharArrayReader( "// t".toCharArray());
 
        StreamTokenizer st = new StreamTokenizer(reader);
        st.slashSlashComments(false);
        st.ordinaryChar('/');
 
        assertEquals('/',st.nextToken());
        assertEquals('/',st.nextToken());
        assertEquals(StreamTokenizer.TT_WORD,st.nextToken());
    } 
     
	/** 
	 * @tests java.io.StreamTokenizer#slashStarComments(boolean) 
	 */ 
	public void test_slashStarCommentsZ() throws IOException { 
		setTest("/* foo \r\n /fiji \r\n*/ -456"); 
		st.ordinaryChar('/');
		st.slashStarComments(true);