Package org.apache.tools.ant.util
Class ReaderInputStream
java.lang.Object
java.io.InputStream
org.apache.tools.ant.util.ReaderInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
StringInputStream
Adapts a
Reader as an InputStream.
This is a stripped down version of org.apache.commons.io.input.ReaderInputStream of Apache Commons IO 2.7.
-
Constructor Summary
ConstructorsConstructorDescriptionReaderInputStream(Reader reader) Construct aReaderInputStreamfor the specifiedReader.ReaderInputStream(Reader reader, String encoding) Construct aReaderInputStreamfor the specifiedReader, with the specified encoding.ReaderInputStream(Reader reader, Charset charset) Construct aReaderInputStreamfor the specifiedReader, with the specified encoding.ReaderInputStream(Reader reader, CharsetEncoder encoder) Construct a newReaderInputStream.ReaderInputStream(Reader reader, CharsetEncoder encoder, int bufferSize) Construct a newReaderInputStream. -
Method Summary
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
ReaderInputStream
Construct a newReaderInputStream.- Parameters:
reader- the targetReaderencoder- the charset encoder- Since:
- 1.10.9
-
ReaderInputStream
Construct a newReaderInputStream.- Parameters:
reader- the targetReaderencoder- the charset encoderbufferSize- the size of the input buffer in number of characters- Since:
- 1.10.9
-
ReaderInputStream
Construct aReaderInputStreamfor the specifiedReader.- Parameters:
reader-Reader. Must not benull.
-
ReaderInputStream
-
ReaderInputStream
-
-
Method Details
-
read
Read the specified number of bytes into an array.- Overrides:
readin classInputStream- Parameters:
array- the byte array to read intooff- the offset to start reading bytes intolen- the number of bytes to read- Returns:
- the number of bytes read or
-1if the end of the stream has been reached - Throws:
IOException- if an I/O error occurs
-
read
Read the specified number of bytes into an array.- Overrides:
readin classInputStream- Parameters:
b- the byte array to read into- Returns:
- the number of bytes read or
-1if the end of the stream has been reached - Throws:
IOException- if an I/O error occurs
-
read
Read a single byte.- Specified by:
readin classInputStream- Returns:
- either the byte read or
-1if the end of the stream has been reached - Throws:
IOException- if an I/O error occurs
-
close
Close the stream. This method will cause the underlyingReaderto be closed.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException- if an I/O error occurs
-