public interface FileChunkedStrategy<T>
NettyOutbound when sending a file
should be done using a ChunkedInput instead of zero-copy (typically when SSL
is used). This in turn allows to manipulate the pipeline and adapt the exact ChunkedInput
used to different situation, like TCP vs HTTP.| Modifier and Type | Method and Description |
|---|---|
ChunkedInput<T> |
chunkFile(FileChannel fileChannel,
long offset,
long length,
int chunkSize)
Given the sent file as a
RandomAccessFile, return a ChunkedInput
"view" of the file, eg. |
void |
cleanupPipeline(NettyContext context)
Once the file has been written, allows to clean the pipeline
(see
preparePipeline(NettyContext)) and do other operations. |
void |
preparePipeline(NettyContext context)
Allow for preparing the pipeline (eg.
|
void preparePipeline(NettyContext context)
NettyContext is provided and can be used to get the
channel() then pipeline().context - the context from which to obtain the channel and pipelineChunkedInput<T> chunkFile(FileChannel fileChannel, long offset, long length, int chunkSize)
RandomAccessFile, return a ChunkedInput
"view" of the file, eg. as a ChunkedFile or a
HttpChunkedInput around a ChunkedFile.fileChannel - the FileChannel for the file being sentoffset - the offset of the file where the transfer beginslength - the number of bytes to transferchunkSize - the number of bytes to fetch on each
ChunkedInput.readChunk(ByteBufAllocator) callChunkedInputvoid cleanupPipeline(NettyContext context)
preparePipeline(NettyContext)) and do other operations.context - the context from which to obtain the channel and pipeline