org.restlet.client.engine.io
Class StringInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.restlet.client.engine.io.StringInputStream
All Implemented Interfaces:
Closeable

public class StringInputStream
extends InputStream

Input stream in which the bytes read are supplied by the contents of a string based on the default character set.

Author:
Thierry Boileau

Field Summary
protected  String text
          The text to stream.
 
Constructor Summary
StringInputStream()
          Constructor.
StringInputStream(String text)
          Constructor.
 
Method Summary
 int available()
           
 void close()
           
 String getText()
          Returns the text to stream.
 int read()
          Reads the next character in the source text.
 int read(char[] cbuf)
           
 int read(char[] cbuf, int off, int len)
           
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

text

protected String text
The text to stream.

Constructor Detail

StringInputStream

public StringInputStream()
Constructor.


StringInputStream

public StringInputStream(String text)
Constructor.

Parameters:
text -
Method Detail

available

public int available()
              throws IOException
Overrides:
available in class InputStream
Returns:
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException

getText

public String getText()
Returns the text to stream.

Returns:
The text to stream.

read

public int read()
         throws IOException
Reads the next character in the source text.

Specified by:
read in class InputStream
Returns:
The next character or -1 if end of text is reached.
Throws:
IOException

read

public int read(char[] cbuf)
         throws IOException
Parameters:
cbuf -
Returns:
Throws:
IOException

read

public int read(char[] cbuf,
                int off,
                int len)
         throws IOException
Parameters:
cbuf -
off -
len -
Returns:
Throws:
IOException


Copyright © 2005-2010 Noelios Technologies.