java.lang.Objectjava.io.InputStream
java.io.StringBufferInputStream
StringReader 类进行创建。
@Deprecated public class StringBufferInputStream
此类允许应用程序创建输入流,在该流中读取的字节由字符串内容提供。应用程序还可以使用 ByteArrayInputStream 从 byte 数组中读取字节。
只有字符串中每个字符的低八位可以由此类使用。
ByteArrayInputStream,
StringReader
| 字段摘要 | |
|---|---|
protected String |
buffer 已过时。 从中读取字节的字符串。 |
protected int |
count 已过时。 输入流缓冲区中有效字符数。 |
protected int |
pos 已过时。 要从输入流缓冲区中读取的下一个字符的索引。 |
| 构造方法摘要 | |
|---|---|
StringBufferInputStream(String s) 已过时。 创建一个字符串输入流,以从指定字符串读取数据。 |
|
| 方法摘要 | |
|---|---|
int |
available() 已过时。 返回无阻塞情况下可以从此输入流读取的字节数。 |
int |
read() 已过时。 从此输入流中读取下一个数据的字节。 |
int |
read(byte[] b, int off, int len) 已过时。 将最多 len 个数据字节从此输入流读入 byte 数组。 |
void |
reset() 已过时。 将输入流重置为开始读取此输入流的基础缓冲区的第一个字符处。 |
long |
skip(long n) 已过时。 从此输入流中跳过输入的 n 个字节。 |
| 从类 java.io.InputStream 继承的方法 |
|---|
close, mark, markSupported, read |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 字段详细信息 |
|---|
protected String buffer
protected int pos
buffer
protected int count
buffer
| 构造方法详细信息 |
|---|
public StringBufferInputStream(String s)
s - 基本输入缓冲区。
| 方法详细信息 |
|---|
public int read()
0 到
255 范围内的
int 字节值。如果因流的末尾已到达而没有可用的字节,则返回值
-1。
StringBufferInputStream 的 read 方法不会阻塞。它返回此输入流的缓冲区中下一个字符的低八位。
InputStream 中的
read
-1。
public int read(byte[] b,
int off,
int len)
len 个数据字节从此输入流读入 byte 数组。
StringBufferInputStream 的 read 方法不会阻塞。它将此输入流的缓冲区中字符的低八位复制到 byte 数组参数中。
InputStream 中的
read
b - 读入数据的缓冲区。
off - 数据的初始偏移量。
len - 读取的最多字节数。
-1。
InputStream.read()
public long skip(long n)
n 个字节。如果已到达输入流的末尾,则可能会跳过非常少的字节。
InputStream 中的
skip
n - 要跳过的字节数。
public int available()
InputStream 中的
available
count - pos 的值,它是要从输入缓冲区中读取的剩余字节数。
public void reset()
InputStream 中的
reset
InputStream.mark(int),
IOException