BufferedInputStream.reset() has the following syntax.
public void reset() throws IOException
In the following code shows how to use BufferedInputStream.reset() method.
//from w ww . j a v a2 s . c o m import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; public class Main { public static void main(String[] args) throws Exception { InputStream iStream = new FileInputStream("c:/test.txt"); // input stream converted to buffered input stream BufferedInputStream bis = new BufferedInputStream(iStream); // read and print characters one by one System.out.println((char) bis.read()); System.out.println((char) bis.read()); System.out.println((char) bis.read()); // mark is set on the input stream bis.mark(0); System.out.println((char) bis.read()); System.out.println("reset() invoked"); // reset is called bis.reset(); // read and print characters System.out.println((char) bis.read()); System.out.println((char) bis.read()); } }