org.restlet.engine.io
Class ReaderInputStream

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

public class ReaderInputStream
extends InputStream

Input stream based on a reader. The implementation relies on the NIO CharsetEncoder class.

Author:
Jerome Louvel

Constructor Summary
ReaderInputStream(Reader reader)
          Constructor.
ReaderInputStream(Reader reader, CharacterSet characterSet)
          Constructor.
 
Method Summary
 int available()
           
 void close()
          Closes the wrapped reader.
 int read()
           
 int read(byte[] b, int off, int len)
           
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReaderInputStream

public ReaderInputStream(Reader reader)
                  throws IOException
Constructor. Uses the CharacterSet.ISO_8859_1 character set by default.

Parameters:
reader - The reader to wrap as an input stream.
Throws:
IOException

ReaderInputStream

public ReaderInputStream(Reader reader,
                         CharacterSet characterSet)
                  throws IOException
Constructor.

Parameters:
reader - The reader to wrap as an input stream.
characterSet - The character set to use for encoding.
Throws:
IOException
Method Detail

available

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

close

public void close()
           throws IOException
Closes the wrapped reader.

Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException

read

public int read()
         throws IOException
Specified by:
read in class InputStream
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Overrides:
read in class InputStream
Throws:
IOException


Copyright © 2005-2013 Restlet.