Reader

In this chapter you will learn:

  1. What is Reader class for and how to use Reader
  2. The Predefined Streams

Use Reader class

Reader is the abstract class for reading character streams.

The following table lists the reader classes which deal with the character based stream.

  • Reader Abstract class that describes character stream input
  • BufferedReader Buffered input character stream
  • CharArrayReader Input stream that reads from a character array
  • FileReader Input stream that reads from a file
  • FilterReader Filtered reader
  • InputStreamReader Input stream that translates bytes to characters
  • LineNumberReader Input stream that counts lines
  • PipedReader Input pipe
  • PushbackReader Input stream that allows characters to be returned to the input stream
  • StringReader Input stream that reads from a string

The Predefined Streams

System.out refers to the standard output stream. By default, this is the console. System.in refers to standard input, which is the keyboard by default. System.err refers to the standard error stream, which also is the console by default. System.in is an object of type InputStream; System.out and System.err are objects of type PrintStream.

Next chapter...

What you will learn in the next chapter:

  1. What is Java FileReader and how to use FileReader
  2. How to read value into a character array
Home » Java Tutorial » Reader Writer
Stream vs Reader and writer
InputStream
FileInputStream
ObjectInputStream
DataInputStream
BufferedInputStream
SequenceInputStream
PushbackInputStream
ByteArrayInputStream
PrintStream
OutputStream
FileOutputStream
DataOutputStream
ObjectOutputStream
BufferedOutputStream
ByteArrayOutputStream
FilterOutputStream
Reader
FileReader
BufferedReader
CharArrayReader
StringReader
LineNumberReader
InputStreamReader
PushbackReader
Writer
FileWriter
BufferedWriter
CharArrayWriter
StringWriter
PrintWriter
OutputStreamWriter