Code example for Writer

Methods: write

0
 
    public void test2() throws IOException { 
        StringWriter sw = new StringWriter();
        Writer w = new LineEndNormalizingWriter(sw);
 
        w.write("abc\ndef\n");
        w.write("\n");
 
        assertEquals(sw.toString(),"abc\r\ndef\r\n\r\n");
    } 
 
    public void test3() throws IOException { 
        StringWriter sw = new StringWriter();
        Writer w = new LineEndNormalizingWriter(sw);
 
        w.write("\r\n\n");
 
        assertEquals(sw.toString(),"\r\n\r\n");
    } 
}