Class SeekableByteChannelRangeWriter
- java.lang.Object
-
- org.eclipse.jetty.server.resource.SeekableByteChannelRangeWriter
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,RangeWriter
public class SeekableByteChannelRangeWriter extends java.lang.Object implements RangeWriter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SeekableByteChannelRangeWriter.ChannelSupplier
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description SeekableByteChannelRangeWriter(java.nio.channels.SeekableByteChannel initialChannel, SeekableByteChannelRangeWriter.ChannelSupplier channelSupplier)
SeekableByteChannelRangeWriter(SeekableByteChannelRangeWriter.ChannelSupplier channelSupplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Field Detail
-
NO_PROGRESS_LIMIT
public static final int NO_PROGRESS_LIMIT
- See Also:
- Constant Field Values
-
channelSupplier
private final SeekableByteChannelRangeWriter.ChannelSupplier channelSupplier
-
bufSize
private final int bufSize
-
buffer
private final java.nio.ByteBuffer buffer
-
channel
private java.nio.channels.SeekableByteChannel channel
-
pos
private long pos
-
defaultSeekMode
private boolean defaultSeekMode
-
-
Constructor Detail
-
SeekableByteChannelRangeWriter
public SeekableByteChannelRangeWriter(SeekableByteChannelRangeWriter.ChannelSupplier channelSupplier)
-
SeekableByteChannelRangeWriter
public SeekableByteChannelRangeWriter(java.nio.channels.SeekableByteChannel initialChannel, SeekableByteChannelRangeWriter.ChannelSupplier channelSupplier)
-
-
Method Detail
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
writeTo
public void writeTo(java.io.OutputStream outputStream, long skipTo, long length) throws java.io.IOException
Description copied from interface:RangeWriter
Write the specific range (start, size) to the outputStream.- Specified by:
writeTo
in interfaceRangeWriter
- Parameters:
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 write- Throws:
java.io.IOException
-
skipTo
private void skipTo(long skipTo) throws java.io.IOException
- Throws:
java.io.IOException
-
fallbackSkipTo
private void fallbackSkipTo(long skipTo) throws java.io.IOException
- Throws:
java.io.IOException
-
-