Interface RandomAccessBody

All Superinterfaces:
AutoCloseable, Body, Closeable
All Known Implementing Classes:
FileBodyGenerator.FileBody, MultipartBody

public interface RandomAccessBody extends Body
A request body which supports random access to its contents.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    transferTo(long position, WritableByteChannel target)
    Transfers the specified chunk of bytes from this body to the specified channel.

    Methods inherited from interface com.ning.http.client.Body

    getContentLength, read

    Methods inherited from interface java.io.Closeable

    close
  • Method Details

    • transferTo

      long transferTo(long position, WritableByteChannel target) throws IOException
      Transfers the specified chunk of bytes from this body to the specified channel.
      Parameters:
      position - The zero-based byte index from which to start the transfer, must not be negative.
      target - The destination channel to transfer the body chunk to, must not be null.
      Returns:
      The non-negative number of bytes actually transferred.
      Throws:
      IOException - If the body chunk could not be transferred.