Package org.apache.wayang.core.util
Class LimitedInputStream
java.lang.Object
java.io.InputStream
org.apache.wayang.core.util.LimitedInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
InputStream
that is trimmed to a specified size. Moreover, it counts the number of read bytes.-
Constructor Summary
ConstructorsConstructorDescriptionLimitedInputStream
(InputStream wrappedInputStream) Create an unlimited instance.LimitedInputStream
(InputStream wrappedInputStream, long maxReadBytes) Create a limited instance. -
Method Summary
Methods inherited from class java.io.InputStream
mark, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skipNBytes, transferTo
-
Constructor Details
-
LimitedInputStream
Create an unlimited instance.- Parameters:
wrappedInputStream
-InputStream
that is to be wrapped by this instance
-
LimitedInputStream
Create a limited instance.- Parameters:
wrappedInputStream
-InputStream
that is to be wrapped by this instancemaxReadBytes
- maximum number of bytes to read from the stream
-
-
Method Details
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
available
- Overrides:
available
in classInputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classInputStream
-
getNumReadBytes
public long getNumReadBytes()- Returns:
- the number of bytes that have been read from this stream
-