Package com.identityworksllc.iiq.common
Class NullInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.identityworksllc.iiq.common.NullInputStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class NullInputStream extends InputStream
An input stream primarily for testing purposes that always contains the given number of zeroes.
-
-
Constructor Summary
Constructors Constructor Description NullInputStream()
Constructs a new NullInputStream with a default input size of 0.NullInputStream(int size)
Constructs a new NullInputStream with the specified input size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
read()
“Reads” one byte from the NullInputStream, returning 0 if we have not exhausted the given pool of bytes (specified by ‘size’) and -1 (EOF) if we have.-
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
NullInputStream
public NullInputStream()
Constructs a new NullInputStream with a default input size of 0.The first read will always produce an EOF.
-
NullInputStream
public NullInputStream(int size)
Constructs a new NullInputStream with the specified input size.- Parameters:
size
- The number of bytes to simulate in the input
-
-
Method Detail
-
read
public int read() throws IOException
“Reads” one byte from the NullInputStream, returning 0 if we have not exhausted the given pool of bytes (specified by ‘size’) and -1 (EOF) if we have.- Specified by:
read
in classInputStream
- Returns:
- 0 or -1
- Throws:
IOException
- never, but the interface requires it
-
-