FileDocCategorySizeDatePackage
DataOutputStreamTest.javaAPI DocAndroid 1.5 API1625Wed May 06 22:42:02 BST 2009android.core

DataOutputStreamTest

public class DataOutputStreamTest extends TestCase
Basic tests for DataOutputStreams.

Fields Summary
Constructors Summary
Methods Summary
public voidtestDataOutputStream()

        String str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
        ByteArrayOutputStream aa = new ByteArrayOutputStream();
        DataOutputStream a = new DataOutputStream(aa);

        try {
            a.write(str.getBytes(), 0, 26);
            a.write('A");

            assertEquals(27, aa.size());
            assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzA", aa.toString());

            a.writeByte('B");
            assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzAB", aa.toString());
            a.writeBytes("BYTES");
            assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzABBYTES", aa.toString());
        } finally {
            a.close();
        }