Skip to content

Java I O Character Streams

Ramesh Fadatare edited this page Jul 16, 2018 · 3 revisions

Character Streams Overview

  • The Java platform stores character values using Unicode conventions. Character stream I/O automatically translates this internal format to and from the local character set. In Western locales, the local character set is usually an 8-bit superset of ASCII.

  • For most applications, I/O with character streams is no more complicated than I/O with byte streams. Input and output done with stream classes automatically translates to and from the local character set. A program that uses character streams in place of byte streams automatically adapts to the local character set and is ready for internationalization — all without extra effort by the programmer.

Using Character Streams

All character stream classes are descended from Reader and Writer.

java.io.Reader (implements java.io.Closeable, java.lang.Readable)

  • java.io.BufferedReader
  • java.io.LineNumberReader
  • java.io.CharArrayReader
  • java.io.FilterReader
  • java.io.PushbackReader
  • java.io.InputStreamReader
  • java.io.FileReader
  • java.io.PipedReader
  • java.io.StringReader

java.io.Writer (implements java.lang.Appendable, java.io.Closeable, java.io.Flushable)

  • java.io.BufferedWriter
  • java.io.CharArrayWriter
  • java.io.FilterWriter
  • java.io.OutputStreamWriter
  • java.io.FileWriter
  • java.io.PipedWriter
  • java.io.PrintWriter
  • java.io.StringWriter
Clone this wiki locally