java.lang.Object
|
+----java.io.InputStream
|
+----java.io.StringBufferInputStream
注释:不推荐使用 StringBufferInputStream 方法。
此类不能将字符正确的转换为字节。同 JDK 1.1 版中的类似,从一个串创建一个流的最佳方法是采用 StringReader 类。
此类允许应用创建一个输入流,从某一串中读取流的字节数据。
应用也能使用 ByteArrayInputStream 方法,从一字节数组中读取字节数据。
此类仅能使用每个字符的低八位数据。
len 个字节数据读入一个字节数组中。
n 个字节数据。
protected String buffer
protected int pos
protected int count
public StringBufferInputStream(String s)
public synchronized int read()
0 到 255 范围内的一个 int 数。如果已读到流的末尾,没有可读的字节时,返回 -1。
StringBufferInputStream 的 read 方法不能阻止。返回输入流缓存中的下一个字符的低八位。
-1,如果已读到流尾。
public synchronized int read(byte b[],
int off,
int len)
len 个字节数据读入一个字节数组中。
StringBufferInputStream 的 read 方法不能阻止。将输入流缓存中字符的低八位数据复制到参数字节数组中。
-1,如果读到流尾不再有数据可读。
public synchronized long skip(long n)
n 个字节数据。 如果已读到输入流的末尾,则不可能跳过数据。
public synchronized int available()
count - pos 的值,输入缓存区中保留的字节数。
public synchronized void reset()