org.apache.hc.core5.http.nio

## Interface FileContentEncoder

- All Superinterfaces:
    ContentEncoder
  All Known Implementing Classes:
    IdentityEncoder, LengthDelimitedEncoder

      public interface FileContentEncoder
      extends ContentEncoder

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

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `transfer(FileChannel src, long position, long count)` Transfers a portion of entity content from the given file channel to the underlying network channel.

    - ### Methods inherited from interface org.apache.hc.core5.http.nio.ContentEncoder

      `complete, isCompleted, write`

- - ### Method Detail

    - #### transfer

          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` - the source FileChannel to transfer data from.
        `position` - The position within the file at which the transfer is to begin; must be non-negative
        `count` - The maximum number of bytes to be transferred; must be non-negative
      Returns:
        The number of bytes, possibly zero, that were actually transferred
      Throws:
        `IOException` - if some I/O error occurs.

Copyright © 2005–2022 The Apache Software Foundation. All rights reserved.