List of Important Stream Classes in Java

This is not a complete list, but few important ones. Please refer to the API doc for the complete list and more details.

 

Direct subclasses of InputStream

  • AudioInputStream

    • An input stream with a specified audio format and length. The length is expressed in sample frames, not bytes.

  • ByteArrayInputStream

    • Contains an internal buffer that contains bytes that may be read from the stream. Note that closing a ByteArrayInputStream has no effect; hence methods in this class can be called even after the stream has been closed without generating an IOException.

  • FileInputStream

    • obtains input bytes from a file in a file system.

  • FilterInputStream

    • FilterInputStream and its children wrap around other input streams and transform the data providing additional functionality.

  • ObjectInputStream

    • deserializes primitive data and objects previously written using an ObjectOutputStream.

  • PipedInputStream

    • contains a buffer, decoupling read operations from write operations, within limits. When connected to a piped output stream; the piped input stream provides whatever data bytes are written to the piped output stream.

  • SequenceInputStream

    • represents the logical concatenation of other input streams ; reads from the first one, then reads from the second one, and so on until the end of file of the last one is reached.

  • StringBufferInputStream

    • create an input stream in which the bytes read are supplied by the contents of a string, but is deprecated in favor of StringReader as StringBufferInputStream does not properly convert characters to bytes. This class is deprecated. 

Corresponding output classes of the above InputStream subclasses in OutputStream are ByteArrayOutputStream, FileOutputStream, FilterOutputStream, ObjectOutputStream, OutputStream, PipedOutputStream.

There are no corresponding output streams for AudioInputStream, SequenceInputStream and StringBufferInputStream.

 

FilterInputStream subclasses

FilterInputStream and its children wrap around other input streams and transform the data providing additional functionality.

FilterInputStream subclasses are:

  • BufferedInputStream

    • Adds the ability to buffer the input and to support the mark and reset methods.

  • CheckedInputStream

    • maintains a checksum of the data being read.

  • CipherInputStream

    • composed of an InputStream and a Cipher so that read methods return data processed by the Cipher.

  • DataInputStream

    • read primitive data types from an underlying input stream in a machine-independent way.

  • DeflaterInputStream

    • filter for compressing data.

  • DigestInputStream

    • updates the associated message digest using the bits going through the stream.

  • InflaterInputStream

    • filter for uncompressing data.

  • LineNumberInputStream -

    • filter that keep track of the current line number. This class is deprecated. 

  • ProgressMonitorInputStream

    • creates a progress monitor to monitor the progress of reading the input stream.

  • PushbackInputStream

    • adds the ability to "push back" or "unread" one byte.

  • Corresponding output classes of the above FilterInputStream subclasses in FilterOutputStream are BufferedOutputStream, CheckedOutputStream, CipherOutputStream, DataOutputStream, DeflaterOutputStream, DigestOutputStream and InflaterOutputStream.

  • PrintStream is also a child of FilterOutputStream.

    • PrintStream adds the ability to print various data value representations conveniently.

    • A PrintStream never throws an IOException; instead, set an internal flag in any such cases and the flag can be tested via the checkError method.

 

Subclasses of Reader

  • BufferedReader

    • Reads text from a character-input stream, buffering characters. Advisable to wrap a BufferedReader around any Reader whose read() operations may be costly, such as FileReaders and InputStreamReaders.

  • CharArrayReader

    • a character buffer that can be used as a character-input stream.

  • FilterReader

    • Reading filtered character streams

  • InputStreamReader

    • bridge from byte streams to character streams: It reads bytes and decodes them into characters using a specified charset.

  • PipedReader

    • Piped character-input streams.

  • StringReader

    • A character stream whose source is a string.

  • LineNumberReader

    • is a subclass of BufferedReader  

    • keeps track of line numbers.

  • PushbackReader

    • is a subclass of FilterReader

    • allows characters to be pushed back into the stream.  

  • FileReader

    • is a subclass of InputStreamReader

    • Convenience class for reading character files.

    • Uses the default character encoding and the default byte-buffer size.

 

Subclasses of Writer are: BufferedWriter, CharArrayWriter, FilterWriter, OutputStreamWriter, PipedWriter, PrintWriter, StringWriter, FileWriter which is a subclass of OutputStreamWriter.

 

PrintWriter prints formatted representations of objects to a text-output stream. Methods in this class never throw I/O exceptions, although some of its constructors may.

Quick Notes Finder Tags

Activities (1) advanced java (1) agile (3) App Servers (6) archived notes (2) Arrays (1) Best Practices (12) Best Practices (Design) (3) Best Practices (Java) (7) Best Practices (Java EE) (1) BigData (3) Chars & Encodings (6) coding problems (2) Collections (15) contests (3) Core Java (All) (55) course plan (2) Database (12) Design patterns (8) dev tools (3) downloads (2) eclipse (9) Essentials (1) examples (14) Exception (1) Exceptions (4) Exercise (1) exercises (6) Getting Started (18) Groovy (2) hadoop (4) hibernate (77) hibernate interview questions (6) History (1) Hot book (5) http monitoring (2) Inheritance (4) intellij (1) java 8 notes (4) Java 9 (1) Java Concepts (7) Java Core (9) java ee exercises (1) java ee interview questions (2) Java Elements (16) Java Environment (1) Java Features (4) java interview points (4) java interview questions (4) javajee initiatives (1) javajee thoughts (3) Java Performance (6) Java Programmer 1 (11) Java Programmer 2 (7) Javascript Frameworks (1) Java SE Professional (1) JPA 1 - Module (6) JPA 1 - Modules (1) JSP (1) Legacy Java (1) linked list (3) maven (1) Multithreading (16) NFR (1) No SQL (1) Object Oriented (9) OCPJP (4) OCPWCD (1) OOAD (3) Operators (4) Overloading (2) Overriding (2) Overviews (1) policies (1) programming (1) Quartz Scheduler (1) Quizzes (17) RabbitMQ (1) references (2) restful web service (3) Searching (1) security (10) Servlets (8) Servlets and JSP (31) Site Usage Guidelines (1) Sorting (1) source code management (1) spring (4) spring boot (3) Spring Examples (1) Spring Features (1) spring jpa (1) Stack (1) Streams & IO (3) Strings (11) SW Developer Tools (2) testing (1) troubleshooting (1) user interface (1) vxml (8) web services (1) Web Technologies (1) Web Technology Books (1) youtube (1)