public class MultipartBody extends Object implements RandomAccessBody
Constructor and Description |
---|
MultipartBody(List<Part> parts,
String contentType,
long contentLength,
byte[] boundary) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
long |
getContentLength()
Gets the length of the body.
|
String |
getContentType() |
long |
read(ByteBuffer buffer)
Reads the next chunk of bytes from the body.
|
long |
transferTo(long position,
WritableByteChannel target)
Transfers the specified chunk of bytes from this body to the specified channel.
|
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public long getContentLength()
Body
getContentLength
in interface Body
public String getContentType()
public long transferTo(long position, WritableByteChannel target) throws IOException
RandomAccessBody
transferTo
in interface RandomAccessBody
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
.IOException
- If the body chunk could not be transferred.public long read(ByteBuffer buffer) throws IOException
Body
read
in interface Body
buffer
- The buffer to store the chunk in, must not be null
.-1
if the body has been read completely.IOException
- If the chunk could not be read.Copyright © 2014. All Rights Reserved.