Top Description Fields Constructors Methods
org.apache.commons.compress.utils

public Class SkipShieldingInputStream

extends FilterInputStream
Class Inheritance
Annotations
@Deprecated
Imports
java.io.FilterInputStream, .IOException, .InputStream

Deprecated

No longer used.

A wrapper that overwrites skip and delegates to read instead.

Some implementations of InputStream implement InputStream#skip 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

Modifier and TypeField and Description
private static final byte[]
private static final int
Inherited from java.io.FilterInputStream:
in

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public long
skip(final long
the number of bytes to be skipped.
n
)

Overrides java.io.FilterInputStream.skip.

Skips over and discards n bytes of data from the input stream.
Inherited from java.io.FilterInputStream:
availableclosemarkmarkSupportedreadreadreadreset

Field Detail

SKIP_BUFFERback to summary
private static final byte[] SKIP_BUFFER
SKIP_BUFFER_SIZEback to summary
private static final int SKIP_BUFFER_SIZE

Constructor Detail

SkipShieldingInputStreamback to summary
public SkipShieldingInputStream(final InputStream in)

Method Detail

skipback to summary
public long skip(final long n) throws IOException

Overrides java.io.FilterInputStream.skip.

Doc from java.io.FilterInputStream.skip.

Skips over and discards n bytes of data from the input stream. The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. The actual number of bytes skipped is returned.

Parameters
n:long

the number of bytes to be skipped.

Returns:long

the actual number of bytes skipped.

Annotations
@Override
Exceptions
IOException:
if in.skip(n) throws an IOException.