| java.lang.Object java.io.InputStream org.mmbase.util.ReaderInputStream
ReaderInputStream | public class ReaderInputStream extends InputStream (Code) | | Oddly enough, Java does not provide this itself. Stolen from Ant code.
Adapts a Reader as an InputStream .
Adapted from StringInputStream .
since: MMBase-1.8.2 version: $Id: ReaderInputStream.java,v 1.2 2007/02/24 21:57:50 nklasens Exp $ |
Constructor Summary | |
public | ReaderInputStream(Reader reader) Construct a ReaderInputStream
for the specified Reader .
Parameters: reader - Reader . | public | ReaderInputStream(Reader reader, String encoding) Construct a ReaderInputStream
for the specified Reader ,
with the specified encoding. |
Method Summary | |
public synchronized int | available() | public synchronized void | close() Closes the Stringreader. | public static void | main(String[] args) | public synchronized void | mark(int limit) Marks the read limit of the StringReader. | public boolean | markSupported() | public synchronized int | read() Reads from the Reader , returning the same value. | public synchronized int | read(byte[] b, int off, int len) | public synchronized void | reset() Resets the StringReader. |
ReaderInputStream | public ReaderInputStream(Reader reader)(Code) | | Construct a ReaderInputStream
for the specified Reader .
Parameters: reader - Reader . Must not be null . |
ReaderInputStream | public ReaderInputStream(Reader reader, String encoding)(Code) | | Construct a ReaderInputStream
for the specified Reader ,
with the specified encoding.
Parameters: reader - non-null Reader . Parameters: encoding - non-null String encoding. |
available | public synchronized int available() throws IOException(Code) | | the current number of bytes ready for reading exception: IOException - if an error occurs |
close | public synchronized void close() throws IOException(Code) | | Closes the Stringreader.
exception: IOException - if the original StringReader fails to be closed |
mark | public synchronized void mark(int limit)(Code) | | Marks the read limit of the StringReader.
Parameters: limit - the maximum limit of bytes that can be read before themark position becomes invalid |
markSupported | public boolean markSupported()(Code) | | false - mark is not supported |
read | public synchronized int read() throws IOException(Code) | | Reads from the Reader , returning the same value.
the value of the next character in the Reader . exception: IOException - if the original Reader fails to be read |
read | public synchronized int read(byte[] b, int off, int len) throws IOException(Code) | | Reads from the Reader into a byte array
Parameters: b - the byte array to read into Parameters: off - the offset in the byte array Parameters: len - the length in the byte array to fill the actual number read into the byte array, -1 atthe end of the stream exception: IOException - if an error occurs |
reset | public synchronized void reset() throws IOException(Code) | | Resets the StringReader.
exception: IOException - if the StringReader fails to be reset |
|
|