public abstract class FilterReader extends Reader
FilterReader
本身提供了默认的方法,通过所有要求的载流。子
FilterReader
应重写这些方法,还可以提供额外的方法和字段。
Modifier | Constructor and Description |
---|---|
protected |
FilterReader(Reader in)
创建一个新的筛选的阅读器。
|
Modifier and Type | Method and Description |
---|---|
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)
跳过的字符。
|
protected Reader in
protected FilterReader(Reader in)
in
-读者对象提供基础流。
null
in
NullPointerException
public int read() throws IOException
read
方法重写,继承类
Reader
IOException
如果I/O错误发生
public int read(char[] cbuf, int off, int len) throws IOException
read
方法重写,继承类
Reader
cbuf
-目的缓冲区
off
偏移,开始存储字符
len
-最大字符数读
IOException
如果I/O错误发生
public long skip(long n) throws IOException
skip
方法重写,继承类
Reader
n
-字符数跳过
IOException
如果I/O错误发生
public boolean ready() throws IOException
ready
方法重写,继承类
Reader
IOException
如果I/O错误发生
public boolean markSupported()
markSupported
方法重写,继承类
Reader
public void mark(int readAheadLimit) throws IOException
mark
方法重写,继承类
Reader
readAheadLimit
的字符数限制,可同时仍保留了马克读。读了这许多字符后,试图重置流可能会失败。
IOException
如果I/O错误发生
public void reset() throws IOException
reset
方法重写,继承类
Reader
IOException
如果I/O错误发生
public void close() throws IOException
Reader
close
接口
Closeable
close
接口
AutoCloseable
close
方法重写,继承类
Reader
IOException
如果I/O错误发生
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.