ch.javasoft.io
Class ReaderInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by ch.javasoft.io.ReaderInputStream
All Implemented Interfaces:
Closeable

public class ReaderInputStream
extends InputStream

Similar to the InputStreamReader as a Reader reading from an InputStream, this ReaderInputStream is an InputStream reading from underlying Reader.


Constructor Summary
ReaderInputStream(Reader reader)
           
ReaderInputStream(Reader reader, String charsetName)
           
 
Method Summary
protected  char[] allocateBuffer()
          Returns a default buffer of size 1024.
 void close()
           
 String getCharsetName()
           
 int read()
           
 int read(byte[] b, int off, int len)
           
 
Methods inherited from class java.io.InputStream
available, 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)

ReaderInputStream

public ReaderInputStream(Reader reader,
                         String charsetName)
                  throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException
Method Detail

getCharsetName

public String getCharsetName()
Returns:
the name of the character set, or null if not specified

allocateBuffer

protected char[] allocateBuffer()
Returns a default buffer of size 1024.


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

close

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