Package com.ning.http.client.multipart
Class MultipartBody
java.lang.Object
com.ning.http.client.multipart.MultipartBody
- All Implemented Interfaces:
Body,RandomAccessBody,Closeable,AutoCloseable
-
Constructor Summary
ConstructorsConstructorDescriptionMultipartBody(List<Part> parts, String contentType, long contentLength, byte[] boundary) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()byte[]longGets the length of the body.longread(ByteBuffer buffer) Reads the next chunk of bytes from the body.longtransferTo(long position, WritableByteChannel target) Transfers the specified chunk of bytes from this body to the specified channel.
-
Constructor Details
-
MultipartBody
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
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.
-
getContentType
-
getBoundary
public byte[] getBoundary() -
transferTo
Description copied from interface:RandomAccessBodyTransfers the specified chunk of bytes from this body to the specified channel.- Specified by:
transferToin interfaceRandomAccessBody- 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 benull.- Returns:
- The non-negative number of bytes actually transferred.
- Throws:
IOException- If the body chunk could not be transferred.
-
read
Description copied from interface:BodyReads the next chunk of bytes from the body.- Specified by:
readin interfaceBody- Parameters:
buffer- 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.
-