Code example for CharArrayWriter

Methods: flush

0
 
    /** 
     * @tests java.io.CharArrayWriter#flush() 
     */ 
    public void test_flush() { 
        cw.flush();
    } 
 
    /** 
     * @tests java.io.CharArrayWriter#reset() 
     */ 
    public void test_reset() throws IOException { 
        cw.write("HelloWorld", 5, 5);
        cw.reset();
        cw.write("HelloWorld", 0, 5);
        cr = new CharArrayReader(cw.toCharArray());
        char[] c = new char[100];
        cr.read(c, 0, 5);
        assertEquals("Reset failed to reset buffer", "Hello", new String(c, 0,
                5)); 
    }