FileDocCategorySizeDatePackage
OutputStreamWriterTest.javaAPI DocAndroid 1.5 API1637Wed May 06 22:42:02 BST 2009android.core

OutputStreamWriterTest

public class OutputStreamWriterTest extends junit.framework.TestCase
Tests basic functionality of an OutputStreamWriter.

Fields Summary
Constructors Summary
Methods Summary
public voidtestOutputStreamWriter()

        String str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
        ByteArrayOutputStream aa = new ByteArrayOutputStream();
        OutputStreamWriter a = new OutputStreamWriter(aa, "ISO8859_1");
        try {
            a.write(str, 0, 4);
            a.write('A");
            // We have to flush the OutputStreamWriter to guarantee
            // that the results will appear in the underlying OutputStream
            a.flush();
            assertEquals("ISO8859_1", a.getEncoding());
            assertEquals(5, aa.size());
            assertEquals("AbCdA", aa.toString());
        } finally {
            a.close();
        }