FilterReader
public abstract class FilterReader
extends Reader
Known Direct Subclasses
|
用于读取过滤的字符流的抽象类。 抽象类FilterReader
本身提供了将所有请求传递给包含的流的默认方法。 FilterReader
子类应该重写其中的一些方法,并且还可以提供其他方法和字段。
Summary
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) 跳过字符。 |
Fields
Protected constructors
FilterReader
FilterReader (Reader in)
创建一个新的过滤阅读器。
Parameters |
in |
Reader : a Reader object providing the underlying stream. |
Public methods
close
void close ()
关闭流并释放与其关联的所有系统资源。 一旦流被关闭,read(),ready(),mark(),reset()或skip()调用将会抛出一个IOException异常。 关闭以前关闭的流不起作用。
mark
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. |
markSupported
boolean markSupported ()
告诉这个流是否支持mark()操作。
Returns |
boolean |
true if and only if this stream supports the mark operation. |
read
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 |
read
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 |
ready
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. |
skip
long skip (long n)
跳过字符。
Parameters |
n |
long : The number of characters to skip |
Returns |
long |
The number of characters actually skipped |