Package org.adempiere.webui.util
Class ReaderInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.adempiere.webui.util.ReaderInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class ReaderInputStream extends InputStream
Adapted fromorg.apache.tools.ant.util.ReaderInputStream.
-
-
Constructor Summary
Constructors Constructor Description ReaderInputStream(Reader reader)Construct aReaderInputStreamfor the specifiedReader.ReaderInputStream(Reader reader, String encoding)Construct aReaderInputStreamfor the specifiedReader, with the specified encoding.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier 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.-
Methods inherited from class java.io.InputStream
nullInputStream, read, readAllBytes, readNBytes, readNBytes, skip, transferTo
-
-
-
-
Constructor Detail
-
ReaderInputStream
public ReaderInputStream(Reader reader)
Construct aReaderInputStreamfor the specifiedReader.- Parameters:
reader-Reader. Must not benull.
-
-
Method Detail
-
read
public int read() throws IOExceptionReads from theReader, returning the same value.- Specified by:
readin classInputStream- Returns:
- the value of the next character in the
Reader. - Throws:
IOException- if the originalReaderfails to be read
-
read
public int read(byte[] b, int off, int len) throws IOExceptionReads from theReaderinto a byte array- Overrides:
readin classInputStream- Parameters:
b- the byte array to read intooff- the offset in the byte arraylen- 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:
IOException- if an error occurs
-
mark
public void mark(int limit)
Marks the read limit of the Reader.- Overrides:
markin classInputStream- Parameters:
limit- the maximum limit of bytes that can be read before the mark position becomes invalid
-
available
public int available() throws IOException- Overrides:
availablein classInputStream- Returns:
- the current number of bytes ready for reading
- Throws:
IOException- if an error occurs
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classInputStream- Returns:
- false - mark is not supported
-
reset
public void reset() throws IOExceptionResets the Reader.- Overrides:
resetin classInputStream- Throws:
IOException- if the Reader fails to be reset
-
close
public void close() throws IOExceptionCloses the Reader.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException- if the original Reader fails to be closed
-
-