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
-回退缓冲区的大小
size <= 0
IllegalArgumentException
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
PushbackReader
类的
mark
总是抛出一个异常。
mark
方法重写,继承类
FilterReader
readAheadLimit
的字符数限制,可同时仍保留了马克读。读了这许多字符后,试图重置流可能会失败。
IOException
一直以来不支持,马克
public void reset() throws IOException
PushbackReader
的
reset
方法总是抛出一个异常。
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.