List of usage examples for java.io FilterInputStream mark
public synchronized void mark(int readlimit)
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); 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();/*from w w w .j ava 2 s . c om*/ 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); 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();// w w w .j av a2 s .co m System.out.println("reset() invoked"); System.out.println((char) fis.read()); System.out.println((char) fis.read()); }