Most visited

Recently visited

Added in API level 1

FilterReader

public abstract class FilterReader
extends Reader

java.lang.Object
    java.io.Reader
      java.io.FilterReader
Known Direct Subclasses


用于读取过滤的字符流的抽象类。 抽象类FilterReader本身提供了将所有请求传递给包含的流的默认方法。 FilterReader子类应该重写其中的一些方法,并且还可以提供其他方法和字段。

摘要(Summary)

Fields

protected Reader in

底层的字符输入流。

Inherited fields

From class java.io.Reader

Protected constructors

FilterReader(Reader in)

创建一个新的过滤阅读器。

公共方法(Public methods)

void close()

关闭流并释放与其关联的所有系统资源。

void mark(int readAheadLimit)

标记流中的当前位置。

boolean markSupported()

告诉这个流是否支持mark()操作。

int read()

读取一个字符。

int read(char[] cbuf, int off, int len)

将字符读入数组的一部分。

boolean ready()

告诉这个流是否准备好被读取。

void reset()

重置流。

long skip(long n)

跳过字符。

继承方法(Inherited methods)

From class java.io.Reader
From class java.lang.Object
From interface java.lang.Readable
From interface java.io.Closeable
From interface java.lang.AutoCloseable

Fields

in

Added in API level 1
Reader in

底层的字符输入流。

Protected constructors

FilterReader

Added in API level 1
FilterReader (Reader in)

创建一个新的过滤阅读器。

参数(Parameters)
in Reader: a Reader object providing the underlying stream.
抛出异常(Throws)
NullPointerException if in is null

公共方法(Public methods)

close

Added in API level 1
void close ()

关闭流并释放与其关联的所有系统资源。 一旦流被关闭,read(),ready(),mark(),reset()或skip()调用将会抛出一个IOException异常。 关闭以前关闭的流不起作用。

抛出异常(Throws)
IOException

mark

Added in API level 1
void mark (int readAheadLimit)

标记流中的当前位置。

参数(Parameters)
readAheadLimit int: Limit on the number of characters that may be read while still preserving the mark. After reading this many characters, attempting to reset the stream may fail.
抛出异常(Throws)
IOException If an I/O error occurs

markSupported

Added in API level 1
boolean markSupported ()

告诉这个流是否支持mark()操作。

返回(Returns)
boolean true if and only if this stream supports the mark operation.

read

Added in API level 1
int read ()

读取一个字符。

返回(Returns)
int The character read, as an integer in the range 0 to 65535 (0x00-0xffff), or -1 if the end of the stream has been reached
抛出异常(Throws)
IOException If an I/O error occurs

read

Added in API level 1
int read (char[] cbuf, 
                int off, 
                int len)

将字符读入数组的一部分。

参数(Parameters)
cbuf char: Destination buffer
off int: Offset at which to start storing characters
len int: Maximum number of characters to read
返回(Returns)
int The number of characters read, or -1 if the end of the stream has been reached
抛出异常(Throws)
IOException If an I/O error occurs

ready

Added in API level 1
boolean ready ()

告诉这个流是否准备好被读取。

返回(Returns)
boolean True if the next read() is guaranteed not to block for input, false otherwise. Note that returning false does not guarantee that the next read will block.
抛出异常(Throws)
IOException If an I/O error occurs

reset

Added in API level 1
void reset ()

重置流。

抛出异常(Throws)
IOException If an I/O error occurs

skip

Added in API level 1
long skip (long n)

跳过字符。

参数(Parameters)
n long: The number of characters to skip
返回(Returns)
long The number of characters actually skipped
抛出异常(Throws)
IOException If an I/O error occurs

Hooray!