📜  Java.io.InputStreamReader类

📅  最后修改于: 2020-11-15 02:45:01             🧑  作者: Mango


介绍

所述java.io.InputStreamReader中类是从字节流提供给字符streams.It读取字节并将其解码为使用指定的charset字符的桥梁。

类声明

以下是Java.io.InputStreamReader类的声明-

public class InputStreamReader
   extends Reader

领域

以下是Java.io.InputStreamReader类的字段-

  • protected Object lock-这是用于同步此流上的操作的对象。

类的构造函数

Sr.No. Constructor & Description
1

InputStreamReader(InputStream in)

This creates an InputStreamReader that uses the default charset.

2

InputStreamReader(InputStream in, Charset cs)

This creates an InputStreamReader that uses the given charset.

3

InputStreamReader(InputStream in, CharsetDecoder dec)

This creates an InputStreamReader that uses the given charset decoder.

4

InputStreamReader(InputStream in, String charsetName)

This creates an InputStreamReader that uses the named charset.

类方法

Sr.No. Method & Description
1 void close()

This method closes the stream and releases any system resources associated with it.

2 String getEncoding()

This method returns the name of the character encoding being used by this stream.

3 int read()

This method reads a single character.

4 int read(char[] cbuf, int offset, int length)

This method reads characters into a portion of an array.

5 boolean ready()

This method tells whether this stream is ready to be read.

方法继承

此类从以下类继承方法-

  • Java.io.Reader
  • Java对象