Code example for CharArrayWriter

Methods: toCharArray, write

0
     */ 
    public void test_writeI() throws IOException { 
        cw.write('T');
        cr = new CharArrayReader(cw.toCharArray());
        assertEquals("Writer failed to write char", 'T', cr.read());
    } 
 
    /** 
     * @tests java.io.CharArrayWriter#write(java.lang.String, int, int) 
     */ 
    public void test_writeLjava_lang_StringII() throws IOException { 
        cw.write("HelloWorld", 5, 5);
        cr = new CharArrayReader(cw.toCharArray());
        char[] c = new char[100];
        cr.read(c, 0, 5);
        assertEquals("Writer failed to write correct chars", "World",
                new String(c, 0, 5));
    } 
 
    /** 
     * @tests java.io.CharArrayWriter#write(java.lang.String, int, int)