Class ProtocolBuffers


  • @Beta
    public class ProtocolBuffers
    extends Object
    Beta
    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
    • 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