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 InputStreamprivate booleanprivate booleanprivate long -
Constructor Summary
ConstructorsConstructorDescriptionLimitedInputStream(InputStream inputStream, long readingByteLimit) Creates a newLimitedInputStreaminstance. -
Method Summary
Methods inherited from class 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 newLimitedInputStreaminstance.- 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:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
mark
public void mark(int readlimit) - Overrides:
markin classInputStream
-
reset
public void reset()- Overrides:
resetin classInputStream
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classInputStream
-
checkReadingByteLimit
- Throws:
ReadingByteLimitException
-