MultipartContent instead.@Deprecated public final class MultipartRelatedContent extends AbstractHttpContent
Limitations:
"boundary"HttpContent.getType() must not be
null
Use forRequest(HttpRequest) to construct. For example:
static void setMediaWithMetadataContent(
HttpRequest request, AtomContent atomContent, InputStreamContent imageContent) {
MultipartRelatedContent.forRequest(request, atomContent, imageContent);
}
writeTo(java.io.OutputStream) can be called multiple times for Multipart/Related content. Parts must not
close the output stream in writeTo(java.io.OutputStream).
Implementation is not thread-safe.
| Constructor and Description |
|---|
MultipartRelatedContent(HttpContent firstPart,
HttpContent... otherParts)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
long |
computeLength()
Deprecated.
Computes and returns the content length or less than zero if not known.
|
void |
forRequest(HttpRequest request)
Deprecated.
Sets this multi-part content as the content for the given HTTP request, and set the
MIME version header to "1.0". |
String |
getBoundary()
Deprecated.
Returns the boundary string to use.
|
Collection<HttpContent> |
getParts()
Deprecated.
Returns the HTTP content parts.
|
boolean |
retrySupported()
Deprecated.
Default implementation returns
true, but subclasses may override. |
MultipartRelatedContent |
setBoundary(String boundary)
Deprecated.
Sets the boundary string to use.
|
MultipartRelatedContent |
setMediaType(HttpMediaType mediaType)
Deprecated.
Sets the media type to use for the Content-Type header, or
null if unspecified. |
void |
writeTo(OutputStream out)
Deprecated.
Writes the byte content to the given output stream.
|
computeLength, getCharset, getEncoding, getLength, getMediaType, getTypepublic MultipartRelatedContent(HttpContent firstPart, HttpContent... otherParts)
firstPart - first HTTP content partotherParts - other HTTP content partspublic void forRequest(HttpRequest request)
MIME version header to "1.0".request - HTTP requestpublic void writeTo(OutputStream out) throws IOException
HttpContentImplementations must not close the output stream, and instead should flush the output stream. Some callers may assume that the the output stream has not been closed, and will fail to work if it has been closed.
Upgrade warning: in prior version 1.13 the implementation of this method was allowed to close the stream, but starting with 1.14 closing the stream is no longer allowed.
out - output streamIOExceptionpublic long computeLength()
throws IOException
AbstractHttpContent
Subclasses may override, but by default this computes the length by calling
AbstractHttpContent.computeLength(HttpContent).
computeLength in class AbstractHttpContentIOExceptionpublic boolean retrySupported()
AbstractHttpContenttrue, but subclasses may override.retrySupported in interface HttpContentretrySupported in class AbstractHttpContentpublic MultipartRelatedContent setMediaType(HttpMediaType mediaType)
AbstractHttpContentnull if unspecified.
This will also overwrite any previously set parameter of the media type (for example
"charset"), and therefore might change other properties as well.
setMediaType in class AbstractHttpContentpublic String getBoundary()
public MultipartRelatedContent setBoundary(String boundary)
Defaults to "END_OF_PART".
public Collection<HttpContent> getParts()
Copyright © 2011-2013 Google. All Rights Reserved.