import java.io.*;

public class MarkResetTest {
    public static void main(String av[]) throws Exception {
        BufferedInputStream b =
	  new BufferedInputStream(new StringBufferInputStream( "ABCDEF"));
        b.mark(3);
        b.read();
        b.read();
        b.read();
        b.reset();
        b.mark(-1);
        byte []bb = new byte[5];
        int r = b.read(bb, 0, 5);
        if (r == 5) {
            System.out.println("Success.");
        } else {
            System.out.println("Failure " + r);
        }
    }
}


/* Expected Output:
Success.
*/

@@ -100,16 +100,558 @@
 eption %7B
+%0A%0A%09// Test BufferedReader%0A%09final int READLEN = 3;%0A%09StringReader source = new StringReader (%220123456789ABC%22);%0A%09BufferedReader br = new BufferedReader (source, 5);%0A%09char buf%5B%5D = new char %5BREADLEN%5D;%0A%0A%09for (;;) %7B%0A%09    br.mark(READLEN);%0A%09    int charsRead = 0;%0A%09    int len = 0;%0A%09    while (charsRead %3C READLEN && %0A%09%09   (len = br.read (buf, charsRead, READLEN-charsRead)) %3E= 0)%0A%09%09charsRead += len;%0A%09    if (len %3C 0)%0A%09%09break;%0A%09    System.out.println (%22read %22 + buf);%0A%09    br.reset();%0A%09    br.read();    // next char%0A%09%7D%0A%0A%09// Test BufferedInputStream
 %0A       
@@ -730,17 +730,16 @@
 tStream(
- 
 %22ABCDEF%22
@@ -1071,17 +1071,16 @@
    %7D%0A%7D%0A%0A
-%0A
 /* Expec
@@ -1091,16 +1091,115 @@
 Output:%0A
+read 012%0Aread 123%0Aread 234%0Aread 345%0Aread 456%0Aread 567%0Aread 678%0Aread 789%0Aread 89A%0Aread 9AB%0Aread ABC%0A
 Success.

Add a test for BufferedReader here.