List of usage examples for java.io LineNumberReader markSupported
public boolean markSupported()
From source file:Main.java
public static void main(String[] args) throws IOException { FileReader fr = new FileReader("C:/test.txt"); LineNumberReader lnr = new LineNumberReader(fr); // reads and prints data from reader System.out.println((char) lnr.read()); System.out.println((char) lnr.read()); // mark invoked at this position lnr.mark(0);/*from w ww . ja v a 2s. c om*/ System.out.println("mark() invoked"); System.out.println((char) lnr.read()); System.out.println((char) lnr.read()); // if this reader supports mark() an reset() if (lnr.markSupported()) { // reset() repositioned the stream to the mark lnr.reset(); System.out.println("reset() invoked"); System.out.println((char) lnr.read()); System.out.println((char) lnr.read()); } lnr.close(); }
From source file:Main.java
public static void main(String[] args) throws IOException { // create new reader FileReader fr = new FileReader("C:/test.txt"); LineNumberReader lnr = new LineNumberReader(fr); // reads and prints data from reader System.out.println((char) lnr.read()); System.out.println((char) lnr.read()); // mark invoked at this position lnr.mark(0);//from ww w . jav a 2 s. c om System.out.println("mark() invoked"); System.out.println((char) lnr.read()); System.out.println((char) lnr.read()); // if this reader supports mark() an reset() if (lnr.markSupported()) { // reset() repositioned the reader to the mark lnr.reset(); System.out.println("reset() invoked"); System.out.println((char) lnr.read()); System.out.println((char) lnr.read()); } lnr.close(); }