Package fr.gouv.vitam.common.junit
Class FakeInputStream
- java.lang.Object
-
- java.io.InputStream
-
- fr.gouv.vitam.common.junit.FakeInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class FakeInputStream extends java.io.InputStreamFake InputStream: test class only
-
-
Constructor Summary
Constructors Constructor Description FakeInputStream(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()intread()intread(byte[] b)intread(byte[] b, int off, int len)longreadCount()
-
-
-
Constructor Detail
-
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 Detail
-
read
public int read()
- Specified by:
readin classjava.io.InputStream
-
available
public int available()
- Overrides:
availablein classjava.io.InputStream
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream
-
read
public int read(byte[] b, int off, int len)- Overrides:
readin classjava.io.InputStream
-
read
public int read(byte[] b)
- Overrides:
readin classjava.io.InputStream
-
readCount
public long readCount()
- Returns:
- the number of truely read bytes
-
-