FileDocCategorySizeDatePackage
BufferedWriterTest.javaAPI DocAndroid 1.5 API1697Wed May 06 22:42:02 BST 2009android.core

BufferedWriterTest

public class BufferedWriterTest extends TestCase
Some basic tests for BufferedWriter.

Fields Summary
Constructors Summary
Methods Summary
public voidtestBufferedWriter()

        String str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
        StringWriter aa = new StringWriter();

        BufferedWriter a = new BufferedWriter(aa, 20);
        try {
            a.write(str.toCharArray(), 0, 26);
            a.write('X");
            a.flush();
            assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzX", aa.toString());

            a.write("alphabravodelta", 5, 5);
            a.flush();
            assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzXbravo", aa.toString());
            a.newLine();
            a.write("I'm on a new line.");
            a.flush();
            assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzXbravo\nI\'m on a new line.", aa.toString());
        } finally {
            a.close();
        }