com.google.protobuf
Interface Parser<MessageType>

All Known Implementing Classes:
AbstractParser, UnknownFieldSet.Parser

public interface Parser<MessageType>

Abstract interface for parsing Protocol Messages. The implementation should be stateless and thread-safe.

Author:
liujisi@google.com (Pherl Liu)

Method Summary
 MessageType parseDelimitedFrom(java.io.InputStream input)
          Like parseFrom(InputStream), but does not read util EOF.
 MessageType parseDelimitedFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry)
          Like parseDelimitedFrom(InputStream) but supporting extensions.
 MessageType parseFrom(byte[] data)
          Parses data as a message of MessageType.
 MessageType parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
          Parses data as a message of MessageType.
 MessageType parseFrom(byte[] data, int off, int len)
          Parses data as a message of MessageType.
 MessageType parseFrom(byte[] data, int off, int len, ExtensionRegistryLite extensionRegistry)
          Parses data as a message of MessageType.
 MessageType parseFrom(ByteString data)
          Parses data as a message of MessageType.
 MessageType parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
          Parses data as a message of MessageType.
 MessageType parseFrom(CodedInputStream input)
          Parses a message of MessageType from the input.
 MessageType parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
          Like parseFrom(CodedInputStream), but also parses extensions.
 MessageType parseFrom(java.io.InputStream input)
          Parse a message of MessageType from input.
 MessageType parseFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry)
          Parses a message of MessageType from input.
 MessageType parsePartialDelimitedFrom(java.io.InputStream input)
          Like parseDelimitedFrom(InputStream), but does not throw an exception if the message is missing required fields.
 MessageType parsePartialDelimitedFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry)
          Like parseDelimitedFrom(InputStream, ExtensionRegistryLite), but does not throw an exception if the message is missing required fields.
 MessageType parsePartialFrom(byte[] data)
          Like parseFrom(byte[]), but does not throw an exception if the message is missing required fields.
 MessageType parsePartialFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
          Like parseFrom(byte[], ExtensionRegistryLite), but does not throw an exception if the message is missing required fields.
 MessageType parsePartialFrom(byte[] data, int off, int len)
          Like parseFrom(byte[], int, int), but does not throw an exception if the message is missing required fields.
 MessageType parsePartialFrom(byte[] data, int off, int len, ExtensionRegistryLite extensionRegistry)
          Like parseFrom(ByteString, ExtensionRegistryLite), but does not throw an exception if the message is missing required fields.
 MessageType parsePartialFrom(ByteString data)
          Like parseFrom(ByteString), but does not throw an exception if the message is missing required fields.
 MessageType parsePartialFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
          Like parseFrom(ByteString, ExtensionRegistryLite), but does not throw an exception if the message is missing required fields.
 MessageType parsePartialFrom(CodedInputStream input)
          Like parseFrom(CodedInputStream), but does not throw an exception if the message is missing required fields.
 MessageType parsePartialFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
          Like parseFrom(CodedInputStream input, ExtensionRegistryLite), but does not throw an exception if the message is missing required fields.
 MessageType parsePartialFrom(java.io.InputStream input)
          Like parseFrom(InputStream), but does not throw an exception if the message is missing required fields.
 MessageType parsePartialFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry)
          Like parseFrom(InputStream, ExtensionRegistryLite), but does not throw an exception if the message is missing required fields.
 

Method Detail

parseFrom

MessageType parseFrom(CodedInputStream input)
                      throws InvalidProtocolBufferException
Parses a message of MessageType from the input.

Note: The caller should call CodedInputStream.checkLastTagWas(int) after calling this to verify that the last tag seen was the appropriate end-group tag, or zero for EOF.

Throws:
InvalidProtocolBufferException

parseFrom

MessageType parseFrom(CodedInputStream input,
                      ExtensionRegistryLite extensionRegistry)
                      throws InvalidProtocolBufferException
Like parseFrom(CodedInputStream), but also parses extensions. The extensions that you want to be able to parse must be registered in extensionRegistry. Extensions not in the registry will be treated as unknown fields.

Throws:
InvalidProtocolBufferException

parsePartialFrom

MessageType parsePartialFrom(CodedInputStream input)
                             throws InvalidProtocolBufferException
Like parseFrom(CodedInputStream), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.

Throws:
InvalidProtocolBufferException

parsePartialFrom

MessageType parsePartialFrom(CodedInputStream input,
                             ExtensionRegistryLite extensionRegistry)
                             throws InvalidProtocolBufferException
Like parseFrom(CodedInputStream input, ExtensionRegistryLite), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.

Throws:
InvalidProtocolBufferException

parseFrom

MessageType parseFrom(ByteString data)
                      throws InvalidProtocolBufferException
Parses data as a message of MessageType. This is just a small wrapper around parseFrom(CodedInputStream).

Throws:
InvalidProtocolBufferException

parseFrom

MessageType parseFrom(ByteString data,
                      ExtensionRegistryLite extensionRegistry)
                      throws InvalidProtocolBufferException
Parses data as a message of MessageType. This is just a small wrapper around parseFrom(CodedInputStream, ExtensionRegistryLite).

Throws:
InvalidProtocolBufferException

parsePartialFrom

MessageType parsePartialFrom(ByteString data)
                             throws InvalidProtocolBufferException
Like parseFrom(ByteString), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.

Throws:
InvalidProtocolBufferException

parsePartialFrom

MessageType parsePartialFrom(ByteString data,
                             ExtensionRegistryLite extensionRegistry)
                             throws InvalidProtocolBufferException
Like parseFrom(ByteString, ExtensionRegistryLite), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.

Throws:
InvalidProtocolBufferException

parseFrom

MessageType parseFrom(byte[] data,
                      int off,
                      int len)
                      throws InvalidProtocolBufferException
Parses data as a message of MessageType. This is just a small wrapper around parseFrom(CodedInputStream).

Throws:
InvalidProtocolBufferException

parseFrom

MessageType parseFrom(byte[] data,
                      int off,
                      int len,
                      ExtensionRegistryLite extensionRegistry)
                      throws InvalidProtocolBufferException
Parses data as a message of MessageType. This is just a small wrapper around parseFrom(CodedInputStream, ExtensionRegistryLite).

Throws:
InvalidProtocolBufferException

parseFrom

MessageType parseFrom(byte[] data)
                      throws InvalidProtocolBufferException
Parses data as a message of MessageType. This is just a small wrapper around parseFrom(CodedInputStream).

Throws:
InvalidProtocolBufferException

parseFrom

MessageType parseFrom(byte[] data,
                      ExtensionRegistryLite extensionRegistry)
                      throws InvalidProtocolBufferException
Parses data as a message of MessageType. This is just a small wrapper around parseFrom(CodedInputStream, ExtensionRegistryLite).

Throws:
InvalidProtocolBufferException

parsePartialFrom

MessageType parsePartialFrom(byte[] data,
                             int off,
                             int len)
                             throws InvalidProtocolBufferException
Like parseFrom(byte[], int, int), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.

Throws:
InvalidProtocolBufferException

parsePartialFrom

MessageType parsePartialFrom(byte[] data,
                             int off,
                             int len,
                             ExtensionRegistryLite extensionRegistry)
                             throws InvalidProtocolBufferException
Like parseFrom(ByteString, ExtensionRegistryLite), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.

Throws:
InvalidProtocolBufferException

parsePartialFrom

MessageType parsePartialFrom(byte[] data)
                             throws InvalidProtocolBufferException
Like parseFrom(byte[]), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.

Throws:
InvalidProtocolBufferException

parsePartialFrom

MessageType parsePartialFrom(byte[] data,
                             ExtensionRegistryLite extensionRegistry)
                             throws InvalidProtocolBufferException
Like parseFrom(byte[], ExtensionRegistryLite), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.

Throws:
InvalidProtocolBufferException

parseFrom

MessageType parseFrom(java.io.InputStream input)
                      throws InvalidProtocolBufferException
Parse a message of MessageType from input. This is just a small wrapper around parseFrom(CodedInputStream). Note that this method always reads the entire input (unless it throws an exception). If you want it to stop earlier, you will need to wrap your input in some wrapper stream that limits reading. Or, use MessageLite.writeDelimitedTo(java.io.OutputStream) to write your message and parseDelimitedFrom(InputStream) to read it.

Despite usually reading the entire input, this does not close the stream.

Throws:
InvalidProtocolBufferException

parseFrom

MessageType parseFrom(java.io.InputStream input,
                      ExtensionRegistryLite extensionRegistry)
                      throws InvalidProtocolBufferException
Parses a message of MessageType from input. This is just a small wrapper around parseFrom(CodedInputStream, ExtensionRegistryLite).

Throws:
InvalidProtocolBufferException

parsePartialFrom

MessageType parsePartialFrom(java.io.InputStream input)
                             throws InvalidProtocolBufferException
Like parseFrom(InputStream), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.

Throws:
InvalidProtocolBufferException

parsePartialFrom

MessageType parsePartialFrom(java.io.InputStream input,
                             ExtensionRegistryLite extensionRegistry)
                             throws InvalidProtocolBufferException
Like parseFrom(InputStream, ExtensionRegistryLite), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.

Throws:
InvalidProtocolBufferException

parseDelimitedFrom

MessageType parseDelimitedFrom(java.io.InputStream input)
                               throws InvalidProtocolBufferException
Like parseFrom(InputStream), but does not read util EOF. Instead, the size of message (encoded as a varint) is read first, then the message data. Use MessageLite.writeDelimitedTo(java.io.OutputStream) to write messages in this format.

Returns:
True if successful, or false if the stream is at EOF when the method starts. Any other error (including reaching EOF during parsing) will cause an exception to be thrown.
Throws:
InvalidProtocolBufferException

parseDelimitedFrom

MessageType parseDelimitedFrom(java.io.InputStream input,
                               ExtensionRegistryLite extensionRegistry)
                               throws InvalidProtocolBufferException
Like parseDelimitedFrom(InputStream) but supporting extensions.

Throws:
InvalidProtocolBufferException

parsePartialDelimitedFrom

MessageType parsePartialDelimitedFrom(java.io.InputStream input)
                                      throws InvalidProtocolBufferException
Like parseDelimitedFrom(InputStream), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.

Throws:
InvalidProtocolBufferException

parsePartialDelimitedFrom

MessageType parsePartialDelimitedFrom(java.io.InputStream input,
                                      ExtensionRegistryLite extensionRegistry)
                                      throws InvalidProtocolBufferException
Like parseDelimitedFrom(InputStream, ExtensionRegistryLite), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.

Throws:
InvalidProtocolBufferException