Package de.julielab.genemapper.utils
Class ReaderInputStream
- java.lang.Object
-
- java.io.InputStream
-
- de.julielab.genemapper.utils.ReaderInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class ReaderInputStream extends InputStream
This class convert Reader to InputStream. It works by converting the characters to the encoding specified in constructor parameter.- Author:
- Petr Hamernik, David Strupl
-
-
Constructor Summary
Constructors Constructor Description ReaderInputStream(Reader reader)Creates new input stream from the given reader.ReaderInputStream(Reader reader, String encoding)Creates new input stream from the given reader and encoding.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()intread()intread(byte[] b, int off, int len)-
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
ReaderInputStream
public ReaderInputStream(Reader reader) throws IOException
Creates new input stream from the given reader. Uses the platform default encoding.- Parameters:
reader- Input reader- Throws:
IOException
-
ReaderInputStream
public ReaderInputStream(Reader reader, String encoding) throws IOException
Creates new input stream from the given reader and encoding.- Parameters:
reader- Input readerencoding-- Throws:
IOException
-
-
Method Detail
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
available
public int available() throws IOException- Overrides:
availablein classInputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
-