Package fr.gouv.vitam.common.stream
Class ExactSizeInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
fr.gouv.vitam.common.stream.ExactSizeInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
Input stream that checks input stream size (avoids premature EOF or invalid file size)
This input stream guaranties that an exception occur BEFORE the last data byte is returned.
For empty streams (size=0), EOF check is done at constructor initialization time.
-
Field Summary
Fields inherited from class java.io.FilterInputStream
in
-
Constructor Summary
-
Method Summary
Methods inherited from class java.io.FilterInputStream
available, close, markSupported
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
ExactSizeInputStream
- Throws:
IOException
-
-
Method Details
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classFilterInputStream
- Throws:
IOException
-
mark
public void mark(int readlimit) - Overrides:
mark
in classFilterInputStream
-
reset
- Overrides:
reset
in classFilterInputStream
- Throws:
IOException
-
getSize
public long getSize()
-