com.google.api.client.protobuf
Class ProtocolBuffers

java.lang.Object
  extended by com.google.api.client.protobuf.ProtocolBuffers

public class ProtocolBuffers
extends Object

Utilities for protocol buffers.

There is no official media type for protocol buffers registered with the IANA. CONTENT_TYPE and ALT_CONTENT_TYPE are some of the more popular choices being used today, but other media types are also in use.

Since:
1.5
Author:
Yaniv Inbar

Field Summary
static String ALT_CONTENT_TYPE
          "application/x-protobuffer" content type.
static String CONTENT_TYPE
          "application/x-protobuf" content type.
 
Method Summary
static
<T extends com.google.protobuf.MessageLite>
T
parseAndClose(InputStream inputStream, Class<T> messageClass)
          Parses protocol buffer content from an input stream (closing the input stream) into a protocol buffer message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTENT_TYPE

public static final String CONTENT_TYPE
"application/x-protobuf" content type.

See Also:
Constant Field Values

ALT_CONTENT_TYPE

public static final String ALT_CONTENT_TYPE
"application/x-protobuffer" content type.

See Also:
Constant Field Values
Method Detail

parseAndClose

public static <T extends com.google.protobuf.MessageLite> T parseAndClose(InputStream inputStream,
                                                                          Class<T> messageClass)
                                                               throws IOException
Parses protocol buffer content from an input stream (closing the input stream) into a protocol buffer message.

Type Parameters:
T - destination message type
Parameters:
messageClass - destination message class that has a parseFrom(InputStream) public static method
Returns:
new instance of the parsed destination message class
Throws:
IOException


Copyright © 2011-2012 Google. All Rights Reserved.