Deprecated
This class does not properly convert characters into bytes. As
of JDK 1.1, the preferred way to create a stream from a
string is via the StringReader
class.
ByteArrayInputStream
.
Only the low eight bits of each character in the string are used by this class.
java.io.ByteArrayInputStream
, java.io.StringReader
Modifier and Type | Field and Description |
---|---|
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. |
Access | Constructor and Description |
---|---|
public | StringBufferInputStream(String
the underlying input buffer. s)Creates a string input stream to read data from the specified string. |
Modifier and Type | Method and Description |
---|---|
public synchronized int | Returns: the value ofcount - pos , which is the
number of bytes remaining to be read from the input buffer.Overrides java. Returns the number of bytes that can be read from the input stream without blocking. |
public synchronized int | Returns: the next byte of data, or-1 if the end of the
stream is reached.Implements abstract java. Reads the next byte of data from this input stream. |
public synchronized int | Returns: the total number of bytes read into the buffer, or-1 if there is no more data because the end of
the stream has been reached.the buffer into which the data is read. b, int the start offset in array off, int b
at which the data is written.the maximum number of bytes to read. len)Overrides java. Reads up to |
public synchronized void | reset()
Overrides java. Resets the input stream to begin reading from the first character of this input stream's underlying buffer. |
public synchronized long | Returns: the actual number of bytes skipped.the number of bytes to be skipped. n)Overrides java. Skips |
buffer | back to summary |
---|---|
protected String buffer The string from which bytes are read. |
count | back to summary |
---|---|
protected int count The number of valid characters in the input stream buffer. |
pos | back to summary |
---|---|
protected int pos The index of the next character to read from the input stream buffer. |
StringBufferInputStream | back to summary |
---|---|
public StringBufferInputStream(String s) Creates a string input stream to read data from the specified string.
|
available | back to summary |
---|---|
public synchronized int available() Overrides java. Returns the number of bytes that can be read from the input stream without blocking.
|
read | back to summary |
---|---|
public synchronized int read() Implements abstract java. Reads the next byte of data from this input stream. The value
byte is returned as an Implementation Specification The
|
read | back to summary |
---|---|
public synchronized int read(byte[] b, int off, int len) Overrides java. Reads up to Implementation Specification The
|
reset | back to summary |
---|---|
public synchronized void reset() Overrides java. Resets the input stream to begin reading from the first character of this input stream's underlying buffer.
|
skip | back to summary |
---|---|
public synchronized long skip(long n) Overrides java. Skips
|