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!