Class java.io.StringBufferInputStream
All Packages Class Hierarchy This Package Previous Next Index
Class java.io.StringBufferInputStream
java.lang.Object
|
+----java.io.InputStream
|
+----java.io.StringBufferInputStream
- public class StringBufferInputStream
- extends InputStream
This class implements a String buffer that can be
used as an InputStream.
-
buffer
- The buffer where data is stored.
-
count
- The number of characters to use in the buffer.
-
pos
- The position in the buffer.
-
StringBufferInputStream(String)
- Creates an StringBufferInputStream from the specified array of
bytes.
-
available()
- Returns the number of available bytes in the buffer.
-
read()
- Reads a byte of data.
-
read(byte[], int, int)
- Reads into an array of bytes.
-
reset()
- Resets the buffer to the beginning.
-
skip(long)
- Skips n bytes of input.
buffer
protected String buffer
- The buffer where data is stored.
pos
protected int pos
- The position in the buffer.
count
protected int count
- The number of characters to use in the buffer.
StringBufferInputStream
public StringBufferInputStream(String s)
- Creates an StringBufferInputStream from the specified array of
bytes.
- Parameters:
- s - the input buffer (not copied)
read
public synchronized int read()
- Reads a byte of data.
- Returns:
- the byte read, or -1 if the end of the
stream is reached.
- Overrides:
- read in class InputStream
read
public synchronized int read(byte b[],
int off,
int len)
- Reads into an array of bytes.
- Parameters:
- b - the buffer into which the data is read
- off - the start offset of the data
- len - the maximum number of bytes read
- Returns:
- the actual number of bytes read; -1 is
returned when the end of the stream is reached.
- Overrides:
- read in class InputStream
skip
public synchronized long skip(long n)
- Skips n bytes of input.
- Parameters:
- n - the number bytes to be skipped
- Returns:
- the actual number of bytes skipped.
- Overrides:
- skip in class InputStream
available
public synchronized int available()
- Returns the number of available bytes in the buffer.
- Overrides:
- available in class InputStream
reset
public synchronized void reset()
- Resets the buffer to the beginning.
- Overrides:
- reset in class InputStream
All Packages Class Hierarchy This Package Previous Next Index