| |
|
| java.lang.Object java.io.InputStream java.io.StringBufferInputStream
StringBufferInputStream | public class StringBufferInputStream extends InputStream (Code) | | StringBufferInputStream is a class for to allow a String to be used as an
InputStream.
|
Field Summary | |
protected String | buffer The String containing the data to read. | protected int | count The total number of characters inside the buffer. | protected int | pos The current position within the String buffer. |
Method Summary | |
public synchronized int | available() Answers an int representing then number of characters that are available
to read. | public synchronized int | read() Reads a single byte from this InputStream and returns the result as an
int. | public synchronized int | read(byte b, int offset, int length) Reads at most length bytes from this InputStream and
stores them in byte array b starting at
offset . | public synchronized void | reset() Reset this InputStream to position 0. | public synchronized long | skip(long n) Skips count number of characters in this InputStream.
Subsequent read() 's will not return these characters
unless reset() is used.
Parameters: n - the number of characters to skip. |
buffer | protected String buffer(Code) | | The String containing the data to read.
|
count | protected int count(Code) | | The total number of characters inside the buffer.
|
pos | protected int pos(Code) | | The current position within the String buffer.
|
StringBufferInputStream | public StringBufferInputStream(String str)(Code) | | Constructs a new StringBufferInputStream on the String str .
Parameters: str - the String to read characters from. |
available | public synchronized int available()(Code) | | Answers an int representing then number of characters that are available
to read.
the number of characters available. |
read | public synchronized int read()(Code) | | Reads a single byte from this InputStream and returns the result as an
int. The low-order byte is returned or -1 of the end of stream was
encountered.
the byte read or -1 if end of stream. |
read | public synchronized int read(byte b, int offset, int length)(Code) | | Reads at most length bytes from this InputStream and
stores them in byte array b starting at
offset . Answer the number of bytes actually read or -1 if
no bytes were read and end of stream was encountered.
Parameters: b - the byte array in which to store the read bytes. Parameters: offset - the offset in b to store the read bytes. Parameters: length - the maximum number of bytes to store in b . the number of bytes actually read or -1 if end of stream. |
reset | public synchronized void reset()(Code) | | Reset this InputStream to position 0. Reads/Skips will now take place
from this position.
|
skip | public synchronized long skip(long n)(Code) | | Skips count number of characters in this InputStream.
Subsequent read() 's will not return these characters
unless reset() is used.
Parameters: n - the number of characters to skip. the number of characters actually skipped. |
|
|
|