java.io.Closeable, java.lang.AutoCloseableStringInputStreampublic class ReaderInputStream
extends java.io.InputStream
Reader as an InputStream.
Adapted from StringInputStream.| Constructor | Description |
|---|---|
ReaderInputStream(java.io.Reader reader) |
Construct a
ReaderInputStream
for the specified Reader. |
ReaderInputStream(java.io.Reader reader,
java.lang.String encoding) |
Construct a
ReaderInputStream
for the specified Reader,
with the specified encoding. |
| Modifier and Type | Method | Description |
|---|---|---|
int |
available() |
|
void |
close() |
Closes the Reader.
|
void |
mark(int limit) |
Marks the read limit of the Reader.
|
boolean |
markSupported() |
|
int |
read() |
Reads from the
Reader, returning the same value. |
int |
read(byte[] b,
int off,
int len) |
Reads from the
Reader into a byte array |
void |
reset() |
Resets the Reader.
|
public ReaderInputStream(java.io.Reader reader)
ReaderInputStream
for the specified Reader.reader - Reader. Must not be null.public ReaderInputStream(java.io.Reader reader,
java.lang.String encoding)
ReaderInputStream
for the specified Reader,
with the specified encoding.reader - non-null Reader.encoding - non-null String encoding.public int read()
throws java.io.IOException
Reader, returning the same value.read in class java.io.InputStreamReader.java.io.IOException - if the original Reader fails to be readpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
Reader into a byte arrayread in class java.io.InputStreamb - the byte array to read intooff - the offset in the byte arraylen - the length in the byte array to filljava.io.IOException - if an error occurspublic void mark(int limit)
mark in class java.io.InputStreamlimit - the maximum limit of bytes that can be read before the
mark position becomes invalidpublic int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOException - if an error occurspublic boolean markSupported()
markSupported in class java.io.InputStreampublic void reset()
throws java.io.IOException
reset in class java.io.InputStreamjava.io.IOException - if the Reader fails to be resetpublic void close()
throws java.io.IOException
close in interface java.lang.AutoCloseableclose in interface java.io.Closeableclose in class java.io.InputStreamjava.io.IOException - if the original Reader fails to be closed