@Beta public class ProtoHttpContent extends AbstractHttpContent
Beta 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.
|
ProtoHttpContent |
setMediaType(HttpMediaType mediaType) |
void |
writeTo(java.io.OutputStream out) |
computeLength, computeLength, getCharset, getMediaType, getType, retrySupportedpublic ProtoHttpContent(com.google.protobuf.MessageLite message)
message - message to serializepublic long getLength()
throws java.io.IOException
getLength in interface HttpContentgetLength in class AbstractHttpContentjava.io.IOExceptionpublic void writeTo(java.io.OutputStream out)
throws java.io.IOException
java.io.IOExceptionpublic final com.google.protobuf.MessageLite getMessage()
public ProtoHttpContent setMediaType(HttpMediaType mediaType)
setMediaType in class AbstractHttpContentCopyright © 2011-2018 Google. All Rights Reserved.