Package fr.gouv.vitam.common.junit
Class FakeInputStream
java.lang.Object
java.io.InputStream
fr.gouv.vitam.common.junit.FakeInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
Fake InputStream: test class only
-
Constructor Summary
ConstructorDescriptionFakeInputStream
(long limit) Constructor of Fake InputStream
Preferred constructorFakeInputStream
(long limit, boolean block) Constructor of Fake InputStreamFakeInputStream
(long limit, boolean block, boolean useRandom) Constructor of Fake InputStream -
Method Summary
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
FakeInputStream
public FakeInputStream(long limit) Constructor of Fake InputStream
Preferred constructor- Parameters:
limit
- the total size of the InputStream
-
FakeInputStream
public FakeInputStream(long limit, boolean block) Constructor of Fake InputStream- Parameters:
limit
- the total size of the InputStreamblock
- True means the byte are read per block and False means one by one read
-
FakeInputStream
public FakeInputStream(long limit, boolean block, boolean useRandom) Constructor of Fake InputStream- Parameters:
limit
- the total size of the InputStreamblock
- True means the byte are read per block and False means one by one readuseRandom
- True use random values for each bytes, else 42 for each
-
-
Method Details
-
read
public int read()- Specified by:
read
in classInputStream
-
available
public int available()- Overrides:
available
in classInputStream
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
-
read
public int read(byte[] b, int off, int len) - Overrides:
read
in classInputStream
-
read
public int read(byte[] b) - Overrides:
read
in classInputStream
-
readCount
public long readCount()- Returns:
- the number of truely read bytes
-