Package org.apache.tools.ant.util
Class ReaderInputStream
- java.lang.Object
- 
- java.io.InputStream
- 
- org.apache.tools.ant.util.ReaderInputStream
 
 
- 
- All Implemented Interfaces:
- java.io.Closeable,- java.lang.AutoCloseable
 - Direct Known Subclasses:
- StringInputStream
 
 public class ReaderInputStream extends java.io.InputStreamAdapts aReaderas anInputStream. Adapted fromStringInputStream.
- 
- 
Constructor SummaryConstructors Constructor Description ReaderInputStream(java.io.Reader reader)Construct aReaderInputStreamfor the specifiedReader.ReaderInputStream(java.io.Reader reader, java.lang.String encoding)Construct aReaderInputStreamfor the specifiedReader, with the specified encoding.ReaderInputStream(java.io.Reader reader, java.nio.charset.Charset charset)Construct aReaderInputStreamfor the specifiedReader, with the specified encoding.
 - 
Method SummaryModifier and Type Method Description intavailable()voidclose()Closes the Reader.voidmark(int limit)Marks the read limit of the Reader.booleanmarkSupported()intread()Reads from theReader, returning the same value.intread(byte[] b, int off, int len)Reads from theReaderinto a byte arrayvoidreset()Resets the Reader.
 
- 
- 
- 
Constructor Detail- 
ReaderInputStreampublic ReaderInputStream(java.io.Reader reader) Construct aReaderInputStreamfor the specifiedReader.- Parameters:
- reader-- Reader. Must not be- null.
 
 - 
ReaderInputStreampublic ReaderInputStream(java.io.Reader reader, java.lang.String encoding)Construct aReaderInputStreamfor the specifiedReader, with the specified encoding.- Parameters:
- reader- non-null- Reader.
- encoding- non-null- Stringencoding.
 
 - 
ReaderInputStreampublic ReaderInputStream(java.io.Reader reader, java.nio.charset.Charset charset)Construct aReaderInputStreamfor the specifiedReader, with the specified encoding.- Parameters:
- reader- non-null- Reader.
- charset- non-null- Charsetcharset.
- Since:
- Ant 1.10.6
 
 
- 
 - 
Method Detail- 
readpublic int read() throws java.io.IOExceptionReads from theReader, returning the same value.- Specified by:
- readin class- java.io.InputStream
- Returns:
- the value of the next character in the Reader.
- Throws:
- java.io.IOException- if the original- Readerfails to be read
 
 - 
readpublic int read(byte[] b, int off, int len) throws java.io.IOExceptionReads from theReaderinto a byte array- Overrides:
- readin class- java.io.InputStream
- Parameters:
- b- the byte array to read into
- off- the offset in the byte array
- len- the length in the byte array to fill
- Returns:
- the actual number read into the byte array, -1 at the end of the stream
- Throws:
- java.io.IOException- if an error occurs
 
 - 
markpublic void mark(int limit) Marks the read limit of the Reader.- Overrides:
- markin class- java.io.InputStream
- Parameters:
- limit- the maximum limit of bytes that can be read before the mark position becomes invalid
 
 - 
availablepublic int available() throws java.io.IOException- Overrides:
- availablein class- java.io.InputStream
- Returns:
- the current number of bytes ready for reading
- Throws:
- java.io.IOException- if an error occurs
 
 - 
markSupportedpublic boolean markSupported() - Overrides:
- markSupportedin class- java.io.InputStream
- Returns:
- false - mark is not supported
 
 - 
resetpublic void reset() throws java.io.IOExceptionResets the Reader.- Overrides:
- resetin class- java.io.InputStream
- Throws:
- java.io.IOException- if the Reader fails to be reset
 
 - 
closepublic void close() throws java.io.IOExceptionCloses the Reader.- Specified by:
- closein interface- java.lang.AutoCloseable
- Specified by:
- closein interface- java.io.Closeable
- Overrides:
- closein class- java.io.InputStream
- Throws:
- java.io.IOException- if the original Reader fails to be closed
 
 
- 
 
-