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.InputStream
Fake 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 int
available()
void
close()
int
read()
int
read(byte[] b)
int
read(byte[] b, int off, int len)
long
readCount()
-
-
-
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:
read
in classjava.io.InputStream
-
available
public int available()
- Overrides:
available
in classjava.io.InputStream
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
-
read
public int read(byte[] b, int off, int len)
- Overrides:
read
in classjava.io.InputStream
-
read
public int read(byte[] b)
- Overrides:
read
in classjava.io.InputStream
-
readCount
public long readCount()
- Returns:
- the number of truely read bytes
-
-