com.ning.http.client.generators
Class ByteArrayBodyGenerator.ByteBody
java.lang.Object
com.ning.http.client.generators.ByteArrayBodyGenerator.ByteBody
- All Implemented Interfaces:
- Body
- Enclosing class:
- ByteArrayBodyGenerator
protected final class ByteArrayBodyGenerator.ByteBody
- extends Object
- implements Body
Method Summary |
void |
close()
Releases any resources associated with this body. |
long |
getContentLength()
Gets the length of the body. |
long |
read(ByteBuffer byteBuffer)
Reads the next chunk of bytes from the body. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ByteArrayBodyGenerator.ByteBody
protected ByteArrayBodyGenerator.ByteBody()
getContentLength
public long getContentLength()
- Description copied from interface:
Body
- Gets the length of the body.
- Specified by:
getContentLength
in interface Body
- Returns:
- The length of the body in bytes, or negative if unknown.
read
public long read(ByteBuffer byteBuffer)
throws IOException
- Description copied from interface:
Body
- Reads the next chunk of bytes from the body.
- Specified by:
read
in interface Body
- Parameters:
byteBuffer
- 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
public void close()
throws IOException
- Description copied from interface:
Body
- Releases any resources associated with this body.
- Specified by:
close
in interface Body
- Throws:
IOException
Copyright © 2011. All Rights Reserved.