FileDocCategorySizeDatePackage
BufferedOutputStreamTest.javaAPI DocAndroid 1.5 API1583Wed May 06 22:42:02 BST 2009android.core

BufferedOutputStreamTest

public class BufferedOutputStreamTest extends TestCase
Tests to verify that simple functionality works for BufferedOutputStreams.

Fields Summary
Constructors Summary
Methods Summary
public voidtestBufferedOutputStream()

        String str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
        ByteArrayOutputStream aa = new ByteArrayOutputStream();
        BufferedOutputStream a = new BufferedOutputStream(aa, 15);
        try {
            a.write(str.getBytes(), 0, 26);
            a.write('A");

            assertEquals(26, aa.size());
            assertEquals(aa.toString(), str);

            a.flush();

            assertEquals(27, aa.size());
            assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzA", aa.toString());
        } finally {
            a.close();
        }