FileDocCategorySizeDatePackage
PushbackReaderTest.javaAPI DocAndroid 1.5 API1757Wed May 06 22:42:02 BST 2009android.core

PushbackReaderTest

public class PushbackReaderTest extends TestCase

Fields Summary
Constructors Summary
Methods Summary
public voidtestPushbackReader()

        String str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
        StringReader aa = new StringReader(str);
        StringReader ba = new StringReader(str);
        StringReader ca = new StringReader(str);

        PushbackReader a = new PushbackReader(aa, 5);
        try {
            a.unread("PUSH".toCharArray());
            assertEquals("PUSHAbCdEfGhIjKlMnOpQrStUvWxYz", IOUtil.read(a));
        } finally {
            a.close();
        }

        PushbackReader b = new PushbackReader(ba, 15);
        try {
            b.unread('X");
            assertEquals("XAbCdEfGhI", IOUtil.read(b, 10));
        } finally {
            b.close();
        }

        PushbackReader c = new PushbackReader(ca);
        try {
            assertEquals("bdfhjlnprtvxz", IOUtil.skipRead(c));
        } finally {
            c.close();
        }