Code example for CharArrayWriter

Methods: sizewrite

0
 
    /** 
     * @tests java.io.CharArrayWriter#size() 
     */ 
    public void test_size() { 
        assertEquals("Returned incorrect size", 0, cw.size());
        cw.write(hw, 5, 5);
        assertEquals("Returned incorrect size", 5, cw.size());
    } 
 
    /** 
     * @tests java.io.CharArrayWriter#toCharArray() 
     */ 
    public void test_toCharArray() throws IOException { 
        cw.write("HelloWorld", 0, 10);
        cr = new CharArrayReader(cw.toCharArray());
        char[] c = new char[100];
        cr.read(c, 0, 10);
        assertEquals("toCharArray failed to return correct array",
                "HelloWorld", new String(c, 0, 10));
Stop searching for code, let great code find you!  Add Codota to your java IDE