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

public Class BoundedSeekableByteChannelInputStream

extends BoundedArchiveInputStream
Class Inheritance
Imports
java.io.IOException, java.nio.ByteBuffer, java.nio.channels.SeekableByteChannel

InputStream that delegates requests to the underlying SeekableByteChannel, making sure that only bytes from a certain range can be read.
Since
1.21

Field Summary

Modifier and TypeField and Description
private final SeekableByteChannel

Constructor Summary

AccessConstructor and Description
public
BoundedSeekableByteChannelInputStream(final long
Position in the stream from where the reading of this bounded stream starts
start
,
final long
Amount of bytes which are allowed to read from the bounded stream
remaining
,
final SeekableByteChannel
Channel which the reads will be delegated to
channel
)

Constructs a bounded stream on the underlying SeekableByteChannel

Method Summary

Modifier and TypeMethod and Description
protected int
read(final long
position to start the read.
pos
,
final ByteBuffer
buffer to add the read content.
buf
)

Implements abstract org.apache.commons.compress.utils.BoundedArchiveInputStream.read.

Reads content of the stream into a ByteBuffer.
Inherited from org.apache.commons.compress.utils.BoundedArchiveInputStream:
readread

Field Detail

channelback to summary
private final SeekableByteChannel channel

Constructor Detail

BoundedSeekableByteChannelInputStreamback to summary
public BoundedSeekableByteChannelInputStream(final long start, final long remaining, final SeekableByteChannel channel)

Constructs a bounded stream on the underlying SeekableByteChannel

Parameters
start:long

Position in the stream from where the reading of this bounded stream starts

remaining:long

Amount of bytes which are allowed to read from the bounded stream

channel:SeekableByteChannel

Channel which the reads will be delegated to

Method Detail

readback to summary
protected int read(final long pos, final ByteBuffer buf) throws IOException

Implements abstract org.apache.commons.compress.utils.BoundedArchiveInputStream.read.

Doc from org.apache.commons.compress.utils.BoundedArchiveInputStream.read.

Reads content of the stream into a ByteBuffer.

Parameters
pos:long

position to start the read.

buf:ByteBuffer

buffer to add the read content.

Returns:int

number of read bytes.

Annotations
@Override
Exceptions
IOException:
if I/O fails.