public class SeekableByteChannelRangeWriter extends java.lang.Object implements RangeWriter
Modifier and Type | Class and Description |
---|---|
static interface |
SeekableByteChannelRangeWriter.ChannelSupplier |
Modifier and Type | Field and Description |
---|---|
private java.nio.ByteBuffer |
buffer |
private int |
bufSize |
private java.nio.channels.SeekableByteChannel |
channel |
private SeekableByteChannelRangeWriter.ChannelSupplier |
channelSupplier |
private boolean |
defaultSeekMode |
static int |
NO_PROGRESS_LIMIT |
private long |
pos |
Constructor and Description |
---|
SeekableByteChannelRangeWriter(SeekableByteChannelRangeWriter.ChannelSupplier channelSupplier) |
SeekableByteChannelRangeWriter(java.nio.channels.SeekableByteChannel initialChannel,
SeekableByteChannelRangeWriter.ChannelSupplier channelSupplier) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
private void |
fallbackSkipTo(long skipTo) |
private void |
skipTo(long skipTo) |
void |
writeTo(java.io.OutputStream outputStream,
long skipTo,
long length)
Write the specific range (start, size) to the outputStream.
|
public static final int NO_PROGRESS_LIMIT
private final SeekableByteChannelRangeWriter.ChannelSupplier channelSupplier
private final int bufSize
private final java.nio.ByteBuffer buffer
private java.nio.channels.SeekableByteChannel channel
private long pos
private boolean defaultSeekMode
public SeekableByteChannelRangeWriter(SeekableByteChannelRangeWriter.ChannelSupplier channelSupplier)
public SeekableByteChannelRangeWriter(java.nio.channels.SeekableByteChannel initialChannel, SeekableByteChannelRangeWriter.ChannelSupplier channelSupplier)
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public void writeTo(java.io.OutputStream outputStream, long skipTo, long length) throws java.io.IOException
RangeWriter
writeTo
in interface RangeWriter
outputStream
- the stream to write toskipTo
- the offset / skip-to / seek-to / position in the resource to start the write fromlength
- the size of the section to writejava.io.IOException
private void skipTo(long skipTo) throws java.io.IOException
java.io.IOException
private void fallbackSkipTo(long skipTo) throws java.io.IOException
java.io.IOException