Closeable, AutoCloseableStringReader class.@Deprecated public class StringBufferInputStream extends InputStream
ByteArrayInputStream.
Only the low eight bits of each character in the string are used by this class.
ByteArrayInputStream,
StringReader| 限定符和类型 | 字段 | 说明 |
|---|---|---|
protected String |
buffer |
已过时。
The string from which bytes are read.
|
protected int |
count |
已过时。
The number of valid characters in the input stream buffer.
|
protected int |
pos |
已过时。
The index of the next character to read from the input stream buffer.
|
| 构造器 | 说明 |
|---|---|
StringBufferInputStream(String s) |
已过时。
Creates a string input stream to read data from the specified string.
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
int |
available() |
已过时。
Returns the number of bytes that can be read from the input
stream without blocking.
|
int |
read() |
已过时。
Reads the next byte of data from this input stream.
|
int |
read(byte[] b,
int off,
int len) |
已过时。
Reads up to
len bytes of data from this input stream
into an array of bytes. |
void |
reset() |
已过时。
Resets the input stream to begin reading from the first character
of this input stream's underlying buffer.
|
long |
skip(long n) |
已过时。
Skips
n bytes of input from this input stream. |
close, mark, markSupported, readprotected String buffer
protected int count
bufferprotected int pos
bufferpublic StringBufferInputStream(String s)
s - the underlying input buffer.public int read()
int in the range
0 to 255. If no byte is available
because the end of the stream has been reached, the value
-1 is returned.
The read method of
StringBufferInputStream cannot block. It returns the
low eight bits of the next character in this input stream's buffer.
read 在类中 InputStream-1 if the end of the
stream is reached.public int read(byte[] b,
int off,
int len)
len bytes of data from this input stream
into an array of bytes.
The read method of
StringBufferInputStream cannot block. It copies the
low eight bits from the characters in this input stream's buffer into
the byte array argument.
read 在类中 InputStreamb - the buffer into which the data is read.off - the start offset of the data.len - the maximum number of bytes read.-1 if there is no more data because the end of
the stream has been reached.InputStream.read()public long skip(long n)
n bytes of input from this input stream. Fewer
bytes might be skipped if the end of the input stream is reached.skip 在类中 InputStreamn - the number of bytes to be skipped.public int available()
available 在类中 InputStreamcount - pos, which is the
number of bytes remaining to be read from the input buffer.public void reset()
reset 在类中 InputStreamInputStream.mark(int),
IOException