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