org.restlet.engine.io
Class ReaderInputStream
java.lang.Object
java.io.InputStream
org.restlet.engine.io.ReaderInputStream
- All Implemented Interfaces:
- java.io.Closeable
public class ReaderInputStream
- extends java.io.InputStream
Input stream based on a reader. The implementation relies on the NIO
CharsetEncoder
class.
- Author:
- Jerome Louvel
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 |
ReaderInputStream
public ReaderInputStream(java.io.Reader reader)
throws java.io.IOException
- Constructor. Uses the
CharacterSet.ISO_8859_1
character set by
default.
- Parameters:
reader
- The reader to wrap as an input stream.
- Throws:
java.io.IOException
ReaderInputStream
public ReaderInputStream(java.io.Reader reader,
CharacterSet characterSet)
throws java.io.IOException
- Constructor.
- Parameters:
reader
- The reader to wrap as an input stream.characterSet
- The character set to use for encoding.
- Throws:
java.io.IOException
available
public int available()
throws java.io.IOException
- Overrides:
available
in class java.io.InputStream
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Closes the wrapped reader.
- Specified by:
close
in interface java.io.Closeable
- Overrides:
close
in class java.io.InputStream
- Throws:
java.io.IOException
read
public int read()
throws java.io.IOException
- Specified by:
read
in class java.io.InputStream
- Throws:
java.io.IOException
read
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
- Overrides:
read
in class java.io.InputStream
- Throws:
java.io.IOException
Copyright © 2005-2013 Restlet.