I am not sure but it looks like readlimit
parameter is ignored.The output of this program
is same independent of the argument to mark.
import java.io.*;
class MarkTest{
public static void main(
String args[]){
try{
InputStream s = new FileInputStream("D:\\test.txt");
BufferedInputStream t = new BufferedInputStream(s);
byte b[] = new byte[10];
if(t.markSupported() == true)
System.out.println("Mark supported");
else
System.out.println("Mark not supported");
t.mark(1);
t.read(b,0,3);
System.out.println("byte read"+b[0]+" "+b[1]+" "+b[2]);
t.reset();
System.out.println("Reset called");
t.read(b,0,3);
System.out.println("byte read"+b[0]+" "+b[1]+" "+b[2]);
}
catch(Exception e){
System.out.println("Exception is"+e);
}
}
}
where test.txt contains string - ABCDEF
Output is:
Mark supported
byte read65 66 67
Reset called
byte read65 66 67
Please advise.