List of usage examples for java.io FilterInputStream reset
public synchronized void reset() throws IOException
mark
method was last called on this input stream. From source file:Main.java
public static void main(String[] args) throws Exception { // create input streams InputStream is = new FileInputStream("C://test.txt"); FilterInputStream fis = new BufferedInputStream(is); // reads and prints BufferedReader System.out.println((char) fis.read()); System.out.println((char) fis.read()); // mark invoked at this position fis.mark(0);/*from w w w. j a va 2s. c om*/ System.out.println("mark() invoked"); System.out.println((char) fis.read()); System.out.println((char) fis.read()); // reset() repositioned the stream to the mark fis.reset(); System.out.println("reset() invoked"); System.out.println((char) fis.read()); System.out.println((char) fis.read()); }
From source file:Main.java
public static void main(String[] args) throws Exception { // create input streams InputStream is = new FileInputStream("C://test.txt"); FilterInputStream fis = new BufferedInputStream(is); // reads and prints filter input stream System.out.println((char) fis.read()); System.out.println((char) fis.read()); // mark invoked at this position fis.mark(0);//from ww w. j a v a2 s . c o m System.out.println("mark() invoked"); System.out.println((char) fis.read()); System.out.println((char) fis.read()); // reset() repositioned the stream to the mark fis.reset(); System.out.println("reset() invoked"); System.out.println((char) fis.read()); System.out.println((char) fis.read()); }