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.

Variable Index

 o buffer
The buffer where data is stored.
 o count
The number of characters to use in the buffer.
 o pos
The position in the buffer.

Constructor Index

 o StringBufferInputStream(String)
Creates an StringBufferInputStream from the specified array of bytes.

Method Index

 o available()
Returns the number of available bytes in the buffer.
 o read()
Reads a byte of data.
 o read(byte[], int, int)
Reads into an array of bytes.
 o reset()
Resets the buffer to the beginning.
 o skip(long)
Skips n bytes of input.

Variables

 o buffer
  protected String buffer
The buffer where data is stored.
 o pos
  protected int pos
The position in the buffer.
 o count
  protected int count
The number of characters to use in the buffer.

Constructors

 o StringBufferInputStream
  public StringBufferInputStream(String s)
Creates an StringBufferInputStream from the specified array of bytes.
Parameters:
s - the input buffer (not copied)

Methods

 o 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
 o 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
 o skip
  public synchronized long skip(long n)
Skips n bytes of input.
Parameters:
n - the number of bytes to be skipped
Returns:
the actual number of bytes skipped.
Overrides:
skip in class InputStream
 o available
  public synchronized int available()
Returns the number of available bytes in the buffer.
Overrides:
available in class InputStream
 o 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