FilterInputStream.read() has the following syntax.
public int read() throws IOException
In the following code shows how to use FilterInputStream.read() method.
import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.FilterInputStream; import java.io.InputStream; //w w w . j a va 2 s. c om public class Main { public static void main(String[] args) throws Exception { int i = 0; char c; // create input streams InputStream is = new FileInputStream("C://test.txt"); FilterInputStream fis = new BufferedInputStream(is); // read till the end of the stream while ((i = fis.read()) != -1) { // converts integer to character c = (char) i; System.out.println("Character read: " + c); } } }