public class ReaderInputStream extends InputStream
Constructor and Description |
---|
ReaderInputStream(Reader reader)
Construct a new ReaderInputStream that uses the default character encoding
with a default input buffer size of 1024 characters.
|
ReaderInputStream(Reader reader,
Charset charset)
Construct a new ReaderInputStream with a default input buffer size of 1024 characters.
|
ReaderInputStream(Reader reader,
CharsetEncoder encoder)
Constructor.
|
ReaderInputStream(Reader reader,
CharsetEncoder encoder,
int bufferSize)
Constructor.
|
ReaderInputStream(Reader reader,
Charset charset,
int bufferSize)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the stream.
|
int |
read()
Read a single byte.
|
int |
read(byte[] b)
Read the specified number of bytes into an array.
|
int |
read(byte[] b,
int off,
int len)
Read the specified number of bytes into an array.
|
available, mark, markSupported, reset, skip
public ReaderInputStream(Reader reader, CharsetEncoder encoder)
reader
- the target Readerencoder
- the charset encoderpublic ReaderInputStream(Reader reader, CharsetEncoder encoder, int bufferSize)
reader
- the target Readerencoder
- the charset encoderbufferSize
- the size of the input buffer in number of characterspublic ReaderInputStream(Reader reader, Charset charset, int bufferSize)
reader
- the target Reader
charset
- the charset encodingbufferSize
- the size of the input buffer in number of characterspublic ReaderInputStream(Reader reader, Charset charset)
reader
- the target Readercharset
- the charset encodingpublic ReaderInputStream(Reader reader)
reader
- the target Readerpublic int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
b
- the byte array to read intooff
- the offset to start reading bytes intolen
- the number of bytes to readIOException
- if an I/O error occurspublic int read(byte[] b) throws IOException
read
in class InputStream
b
- the byte array to read intoIOException
- if an I/O error occurspublic int read() throws IOException
read
in class InputStream
IOException
- if an I/O error occurspublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
- if an I/O error occurs