com.ning.http.client
Interface Body

All Known Subinterfaces:
RandomAccessBody
All Known Implementing Classes:
ByteArrayBodyGenerator.ByteBody, FileBodyGenerator.FileBody, InputStreamBodyGenerator.ISBody, MultipartBody

public interface Body

A request body.


Method Summary
 void close()
          Releases any resources associated with this body.
 long getContentLength()
          Gets the length of the body.
 long read(ByteBuffer buffer)
          Reads the next chunk of bytes from the body.
 

Method Detail

getContentLength

long getContentLength()
Gets the length of the body.

Returns:
The length of the body in bytes, or negative if unknown.

read

long read(ByteBuffer buffer)
          throws IOException
Reads the next chunk of bytes from the body.

Parameters:
buffer - The buffer to store the chunk in, must not be null.
Returns:
The non-negative number of bytes actually read or -1 if the body has been read completely.
Throws:
IOException - If the chunk could not be read.

close

void close()
           throws IOException
Releases any resources associated with this body.

Throws:
IOException


Copyright © 2011. All Rights Reserved.