Package org.xnio.streams
Class LimitedInputStream
java.lang.Object
java.io.InputStream
org.xnio.streams.LimitedInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
An input stream which truncates the underlying stream to the given length.
- Author:
- David M. Lloyd
-
Constructor Summary
ConstructorsConstructorDescriptionLimitedInputStream
(InputStream delegate, long size) Construct a new instance. -
Method Summary
Methods inherited from class java.io.InputStream
nullInputStream, read, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
LimitedInputStream
Construct a new instance.- Parameters:
delegate
- the delegate streamsize
- the maximum size to pass
-
-
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
-
mark
public void mark(int limit) - Overrides:
mark
in classInputStream
-
reset
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classInputStream
-