List of usage examples for java.io FilterReader reset
public void reset() throws IOException
From source file:Main.java
public static void main(String[] args) throws Exception { Reader r = new StringReader("ABCDEF"); // create new filter reader FilterReader fr = new FilterReader(r) { };/* w w w . j a v a 2s. c o m*/ // reads and prints FilterReader System.out.println((char) fr.read()); System.out.println((char) fr.read()); // mark invoked at this position fr.mark(0); System.out.println("mark() invoked"); System.out.println((char) fr.read()); System.out.println((char) fr.read()); // reset() repositioned the stream to the mark fr.reset(); System.out.println("reset() invoked"); System.out.println((char) fr.read()); System.out.println((char) fr.read()); }
From source file:Main.java
public static void main(String[] args) throws Exception { Reader r = new StringReader("ABCDEF"); // create new filter reader FilterReader fr = new FilterReader(r) { };//ww w. j av a2 s. c o m // read and print characters one by one System.out.println("Char : " + (char) fr.read()); System.out.println("Char : " + (char) fr.read()); System.out.println("Char : " + (char) fr.read()); // mark is set on the filter reader fr.mark(0); System.out.println("Char : " + (char) fr.read()); System.out.println("reset() invoked"); // reset is called fr.reset(); // read and print characters System.out.println("char : " + (char) fr.read()); System.out.println("char : " + (char) fr.read()); }