Package com.ning.http.client.generators
Class ByteArrayBodyGenerator.ByteBody
java.lang.Object
com.ning.http.client.generators.ByteArrayBodyGenerator.ByteBody
- All Implemented Interfaces:
Body,Closeable,AutoCloseable
- Enclosing class:
- ByteArrayBodyGenerator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()longGets the length of the body.longread(ByteBuffer byteBuffer) Reads the next chunk of bytes from the body.
-
Constructor Details
-
ByteBody
protected ByteBody()
-
-
Method Details
-
getContentLength
public long getContentLength()Description copied from interface:BodyGets the length of the body.- Specified by:
getContentLengthin interfaceBody- Returns:
- The length of the body in bytes, or negative if unknown.
-
read
Description copied from interface:BodyReads the next chunk of bytes from the body.- Specified by:
readin interfaceBody- Parameters:
byteBuffer- The buffer to store the chunk in, must not benull.- Returns:
- The non-negative number of bytes actually read or
-1if the body has been read completely. - Throws:
IOException- If the chunk could not be read.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-