Top Description Methods
org.apache.hc.core5.http.nio

public Interface FileContentEncoder

extends ContentEncoder
Known Direct Implementers
org.apache.hc.core5.http.impl.nio.IdentityEncoder, org.apache.hc.core5.http.impl.nio.LengthDelimitedEncoder
Imports
java.io.IOException, java.nio.channels.FileChannel

A content encoder capable of transferring data directly from a FileChannel
Since
4.0

Method Summary

Modifier and TypeMethod and Description
public long

Returns:

The number of bytes, possibly zero, that were actually transferred
transfer
(FileChannel
the source FileChannel to transfer data from.
src
,
long
The position within the file at which the transfer is to begin; must be non-negative
position
,
long
The maximum number of bytes to be transferred; must be non-negative
count
)

Transfers a portion of entity content from the given file channel to the underlying network channel.

Inherited from org.apache.hc.core5.http.nio.ContentEncoder:
completeisCompletedwrite

Method Detail

transferback to summary
public long transfer(FileChannel src, long position, long count) throws IOException

Transfers a portion of entity content from the given file channel to the underlying network channel.

Parameters
src:FileChannel

the source FileChannel to transfer data from.

position:long

The position within the file at which the transfer is to begin; must be non-negative

count:long

The maximum number of bytes to be transferred; must be non-negative

Returns:long

The number of bytes, possibly zero, that were actually transferred

Exceptions
IOException:
if some I/O error occurs.