Class LimitedInputStream
java.lang.Object
java.io.InputStream
com.itextpdf.styledxmlparser.resolver.resource.LimitedInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
Implementation of the
InputStream
abstract class, which is used to restrict
reading bytes from input stream i.e. if more bytes are read than the readingByteLimit,
an ReadingByteLimitException
exception will be thrown.
Note that the readingByteLimit is not taken into account in the skip(long)
,
available()
, mark(int)
and reset()
methods.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate InputStream
private boolean
private boolean
private long
-
Constructor Summary
ConstructorsConstructorDescriptionLimitedInputStream
(InputStream inputStream, long readingByteLimit) Creates a newLimitedInputStream
instance. -
Method Summary
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
isStreamRead
private boolean isStreamRead -
isLimitViolated
private boolean isLimitViolated -
readingByteLimit
private long readingByteLimit -
inputStream
-
-
Constructor Details
-
LimitedInputStream
Creates a newLimitedInputStream
instance.- Parameters:
inputStream
- the input stream, the reading of bytes from which will be limitedreadingByteLimit
- the reading byte limit, must not be less than zero
-
-
Method Details
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
available
- Overrides:
available
in classInputStream
- Throws:
IOException
-
mark
public void mark(int readlimit) - Overrides:
mark
in classInputStream
-
reset
public void reset()- Overrides:
reset
in classInputStream
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classInputStream
-
checkReadingByteLimit
- Throws:
ReadingByteLimitException
-