|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.api.client.http.AbstractHttpContent
com.google.api.client.http.protobuf.ProtoHttpContent
public class ProtoHttpContent
Serializes of a protocol buffer message to HTTP content.
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 Summary | |
---|---|
ProtoHttpContent(com.google.protobuf.MessageLite message)
|
Method Summary | |
---|---|
long |
getLength()
Default implementation calls AbstractHttpContent.computeLength() once and caches it for future
invocations, but subclasses may override. |
com.google.protobuf.MessageLite |
getMessage()
Returns the message to serialize. |
String |
getType()
Returns the content type or null for none. |
ProtoHttpContent |
setType(String type)
Sets the content type or null for none. |
void |
writeTo(OutputStream out)
Writes the content to the given output stream. |
Methods inherited from class com.google.api.client.http.AbstractHttpContent |
---|
computeLength, getEncoding, retrySupported |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ProtoHttpContent(com.google.protobuf.MessageLite message)
message
- message to serializeMethod Detail |
---|
public long getLength() throws IOException
AbstractHttpContent
AbstractHttpContent.computeLength()
once and caches it for future
invocations, but subclasses may override.
getLength
in interface HttpContent
getLength
in class AbstractHttpContent
IOException
public String getType()
HttpContent
null
for none.
public void writeTo(OutputStream out) throws IOException
HttpContent
IOException
public ProtoHttpContent setType(String type)
null
for none.
Default value is ProtocolBuffers.CONTENT_TYPE
.
public final com.google.protobuf.MessageLite getMessage()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |