@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(OutputStream out) |
computeLength, computeLength, getCharset, getMediaType, getType, retrySupportedpublic ProtoHttpContent(com.google.protobuf.MessageLite message)
message - message to serializepublic long getLength()
throws IOException
getLength in interface HttpContentgetLength in class AbstractHttpContentIOExceptionpublic void writeTo(OutputStream out) throws IOException
IOExceptionpublic final com.google.protobuf.MessageLite getMessage()
public ProtoHttpContent setMediaType(HttpMediaType mediaType)
setMediaType in class AbstractHttpContentCopyright © 2011–2024 Google. All rights reserved.