Class SkipShieldingInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.apache.commons.compress.utils.SkipShieldingInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
A wrapper that overwrites
skip(long)
and delegates to FilterInputStream.read()
instead.
Some implementations of InputStream
implement InputStream.skip(long)
in a way that throws an exception if the stream
is not seekable - System.in
is known to behave
that way. For such a stream it is impossible to invoke skip at all
and you have to read from the stream (and discard the data read)
instead. Skipping is potentially much faster than reading so we do
want to invoke skip
when possible. We provide this class so
you can wrap your own InputStream
in it if you encounter
problems with skip
throwing an exception.
- Since:
- 1.17
-
Field Summary
Fields inherited from class java.io.FilterInputStream
in
-
Constructor Summary
-
Method Summary
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, read, read, reset
-
Constructor Details
-
SkipShieldingInputStream
-
-
Method Details
-
skip
- Overrides:
skip
in classFilterInputStream
- Throws:
IOException
-