Class java.io.StringInputStream
All Packages    This Package    Previous    Next

Class java.io.StringInputStream

java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.StringInputStream

public class StringInputStream
extends InputStream
String input stream, can be constructed from a String. Allows a String to be read as though it's a Stream.
Author:
James Gosling

StringInputStream(String)
Creates an input file given a string.

available()
Returns the number of bytes that can be read without blocking.
close()
Closes the input stream.
read()
Reads a byte.
skip(int)
Skips bytes of input.

StringInputStream
  public StringInputStream(String str)
Creates an input file given a string.

read
  public synchronized int read()
Reads a byte.
Returns:
the byte read, or -1 if the end of the stream is reached.
Overrides:
read in class InputStream

skip

  public synchronized int skip(int n)
Skips bytes of input.
Parameters:
n - bytes to be skipped
Returns:
actual number of bytes skipped
Throws: IOException
i/o error occurred
Overrides:
skip in class InputStream

available

  public synchronized int available()
Returns the number of bytes that can be read without blocking.
Returns:
the number of available bytes, which is initially equal to the file size
Overrides:
available in class InputStream

close

  public synchronized void close()
Closes the input stream.
Throws: IOException
i/o error occurred
Overrides:
close in class InputStream


All Packages    This Package    Previous    Next