public class ProtoHttpContent extends AbstractHttpContent
Sample usage:
static HttpRequest buildPostRequest(
HttpRequestFactory requestFactory, GenericUrl url, MessageLite message) throws IOException {
return requestFactory.buildPostRequest(url, new ProtoHttpContent(message));
}
Implementation is not thread-safe.
| Constructor and Description |
|---|
ProtoHttpContent(com.google.protobuf.MessageLite message) |
| Modifier and Type | Method and Description |
|---|---|
long |
getLength() |
com.google.protobuf.MessageLite |
getMessage()
Returns the message to serialize.
|
String |
getType() |
ProtoHttpContent |
setMediaType(HttpMediaType mediaType) |
ProtoHttpContent |
setType(String type)
Sets the content type or
null for none. |
void |
writeTo(OutputStream out) |
computeLength, getCharset, getEncoding, getMediaType, retrySupportedpublic ProtoHttpContent(com.google.protobuf.MessageLite message)
message - message to serializepublic long getLength()
throws IOException
getLength in interface HttpContentgetLength in class AbstractHttpContentIOExceptionpublic String getType()
getType in interface HttpContentgetType in class AbstractHttpContentpublic void writeTo(OutputStream out) throws IOException
IOExceptionpublic ProtoHttpContent setType(String type)
null for none.
Default value is ProtocolBuffers.CONTENT_TYPE.
public final com.google.protobuf.MessageLite getMessage()
public ProtoHttpContent setMediaType(HttpMediaType mediaType)
setMediaType in class AbstractHttpContentCopyright © 2011-2012 Google. All Rights Reserved.