Code example for CharArrayWriter

Methods: resettoCharArraywrite

0
 
    /** 
     * @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)); 
    } 
 
    /** 
     * @tests java.io.CharArrayWriter#size() 
     */ 
    public void test_size() { 
        assertEquals("Returned incorrect size", 0, cw.size());
        cw.write(hw, 5, 5);