InputStreamReader : InputStreamReader « File « Java Tutorial





  1. An InputStreamReader reads bytes and translates them into characters using the specified character set.
  2. InputStreamReader is ideal for reading from the output of an OutputStreamWriter or a PrintWriter.

The InputStreamReader class has four constructors:

public InputStreamReader (InputStream in)
public InputStreamReader (InputStream in, java.nio.charset.Charset cs)
public InputStreamReader (InputStream in, java.nio.charset.CharsetDecoder, dec)
public InputStreamReader (InputStream in, String charsetName)

To create an InputStreamReader:

InputStreamReader reader = new InputStreamReader(new FileInputStream (filePath), charSet);










11.15.InputStreamReader
11.15.1.InputStreamReader
11.15.2.Uses a PrintWriter to write two Chinese characters and read them back.
11.15.3.Reading ISO Latin-1 Encoded Data
11.15.4.Get a class of an object
11.15.5.Deal with Keyboard Input with BufferedReader