Java FilterInputStream(InputStream in) Constructor
Syntax
FilterInputStream(InputStream in) constructor from FilterInputStream has the following syntax.
protected FilterInputStream(InputStream in)
Example
In the following code shows how to use FilterInputStream.FilterInputStream(InputStream in) constructor.
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FilterInputStream;
import java.io.InputStream;
/* w ww . j a v a2 s. c om*/
public class Main {
public static void main(String[] args) throws Exception {
int i = 0;
// 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
char c = (char) i;
System.out.println("Character read: " + c);
}
}
}
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »