public class PushbackReader extends FilterReader
in| Constructor and Description |
|---|
PushbackReader(Reader in)
用一个字符的后置缓冲区创建一个新的推回阅读器。
|
PushbackReader(Reader in, int size)
使用给定大小的推回缓冲区创建一个新的推回阅读器。
|
| 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)
跳过字符
|
void |
unread(char[] cbuf)
将一个字符数组复制回推回缓冲区的前端。
|
void |
unread(char[] cbuf, int off, int len)
通过将一部分字符复制到推回缓冲区的前端来推回。
|
void |
unread(int c)
将单个字符复制回推回缓冲区的前端。
|
public PushbackReader(Reader in, int size)
in - 从哪个角色读取的读者
size - 推回缓冲区的大小
IllegalArgumentException - 如果
size <= 0
public PushbackReader(Reader in)
in - 从哪个字符读取的读者
public int read()
throws IOException
read在
FilterReader
IOException - 如果发生I / O错误
public int read(char[] cbuf,
int off,
int len)
throws IOException
read在
FilterReader
cbuf - 目的缓冲区
off - 开始写入字符的偏移量
len - 要读取的最大字符数
IOException - 如果发生I / O错误
public void unread(int c)
throws IOException
(char)c 。
c - 表示要推回的字符的int值
IOException - 如果推回缓冲区已满,或者发生其他I / O错误
public void unread(char[] cbuf,
int off,
int len)
throws IOException
cbuf[off] ,之后的字符将具有值cbuf[off+1]等等。
cbuf - 字符数组
off - 第一个字符的推移偏移
len - 要推回的字符数
IOException - 如果推回缓冲区中没有足够的空间,或者发生其他I / O错误
public void unread(char[] cbuf)
throws IOException
cbuf[0] ,之后的字符将具有值cbuf[1]等等。
cbuf - 要推回的字符数组
IOException - 如果推回缓冲区中没有足够的空间,或者发生其他I / O错误
public boolean ready()
throws IOException
ready在类别
FilterReader
IOException - 如果发生I / O错误
public void mark(int readAheadLimit)
throws IOException
mark类PushbackReader总是抛出异常。
mark在类别
FilterReader
readAheadLimit - 限制仍然保留标记时可能读取的字符数。
读了这么多字符后,尝试重置流可能会失败。
IOException - 始终,因为不支持标记
public void reset()
throws IOException
reset的方法PushbackReader总是抛出异常。
reset在类别
FilterReader
IOException - 始终,因为不支持重置
public boolean markSupported()
markSupported在类别
FilterReader
public void close()
throws IOException
close在界面
Closeable
close在界面
AutoCloseable
close在
FilterReader
IOException - 如果发生I / O错误
public long skip(long n)
throws IOException
skip在类别
FilterReader
n - 要跳过的字符数
IllegalArgumentException - 如果
n为负数。
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.