- java.lang.Object
-
- java.io.InputStream
-
- org.refcodes.io.BlockingInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class BlockingInputStream extends InputStream
TheBlockingInputStreamwraps anInputStreamadding blocking functionality, e.g. when trying to read the read operation is blocked tillavailable()returns a value greater than 0. Use aTimeoutInputStreamto combine theBlockingInputStreamwith a timeout.
-
-
Constructor Summary
Constructors Constructor Description BlockingInputStream(InputStream aInputStream)Decorates the providedInputStreamblocking functionality
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()voidmark(int readlimit)booleanmarkSupported()intread()intread(byte[] aB)intread(byte[] aB, int aOff, int aLen)byte[]readAllBytes()intreadNBytes(byte[] aB, int aOff, int aLen)voidreset()-
Methods inherited from class java.io.InputStream
nullInputStream, readNBytes, skip, transferTo
-
-
-
-
Constructor Detail
-
BlockingInputStream
public BlockingInputStream(InputStream aInputStream)
Decorates the providedInputStreamblocking functionality- Parameters:
aInputStream- TheInputStreamto be decorated accordingly.
-
-
Method Detail
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] aB) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] aB, int aOff, int aLen) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
readAllBytes
public byte[] readAllBytes() throws IOException- Overrides:
readAllBytesin classInputStream- Throws:
IOException
-
readNBytes
public int readNBytes(byte[] aB, int aOff, int aLen) throws IOException- Overrides:
readNBytesin classInputStream- Throws:
IOException
-
available
public int available() throws IOException- Overrides:
availablein classInputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
mark
public void mark(int readlimit)
- Overrides:
markin classInputStream
-
reset
public void reset() throws IOException- Overrides:
resetin classInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classInputStream
-
-