Java FilterInputStream ClassLast Updated : 23 Jan 2026 The FilterInputStream class in Java is used to wrap another input stream and provide additional functionality while reading data. In this chapter, we will learn what the FilterInputStream class is, why it is used, its declaration, constructor, methods, and how it works with an example. What is FilterInputStream in Java?The FilterInputStream class is an input stream that wraps another InputStream, and it is used to filter or modify the data while reading from the stream. It acts as a base class for other input stream classes such as BufferedInputStream, DataInputStream. Due to this reason, it is rarely used directly in applications and is mainly used as a superclass. FilterInputStream Class DeclarationThe following declaration shows how the FilterInputStream class is defined in Java. Constructor of FilterInputStream ClassThe FilterInputStream class provides a constructor to wrap an existing input stream. FilterInputStream(InputStream in)This constructor creates a new FilterInputStream that reads data from the specified input stream. Syntax: Here is the syntax of the constructor: ExampleThe following example demonstrates how to create a FilterInputStream object. Methods of FilterInputStream ClassThe FilterInputStream class provides methods to read and manage input data.
Example of FilterInputStream ClassThis example demonstrates how to read data from a file using the FilterInputStream class. Here, we are assuming that you have following data in "testout.txt" file: Welcome to javatpoint Output: Welcome to javatpoint Next TopicJava ObjectStream Class |
We request you to subscribe our newsletter for upcoming updates.