Package com.google.protobuf
Class MicroEJParser<T extends MicroEJMessageLite>
- java.lang.Object
-
- com.google.protobuf.MicroEJParser<T>
-
- Type Parameters:
T- the message type this parser reads.
- All Implemented Interfaces:
Parser<T>
public final class MicroEJParser<T extends MicroEJMessageLite> extends Object implements Parser<T>
AParserfor a message that protoc-gen-microej generated.One instance serves one message type. It holds the default instance of that type and calls
MicroEJMessageLite.microejParseFrom(CodedInputStream, ExtensionRegistryLite)on it, so the generated code adds one static field and one method per message instead of one class.
-
-
Constructor Summary
Constructors Constructor Description MicroEJParser(T defaultInstance)Creates a parser for the type of the given default instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TparseDelimitedFrom(InputStream input)LikeParser.parseFrom(InputStream), but does not read until EOF.TparseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)LikeParser.parseDelimitedFrom(InputStream)but supporting extensions.TparseFrom(byte[] data)Parsesdataas a message ofMessageType.TparseFrom(byte[] data, int off, int len)Parsesdataas a message ofMessageType.TparseFrom(byte[] data, int off, int len, ExtensionRegistryLite extensionRegistry)Parsesdataas a message ofMessageType.TparseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)Parsesdataas a message ofMessageType.TparseFrom(ByteString data)Parsesdataas a message ofMessageType.TparseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)Parsesdataas a message ofMessageType.TparseFrom(CodedInputStream input)Parses a message ofMessageTypefrom the input.TparseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)LikeParser.parseFrom(CodedInputStream), but also parses extensions.TparseFrom(InputStream input)Parse a message ofMessageTypefrominput.TparseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)Parses a message ofMessageTypefrominput.TparseFrom(ByteBuffer data)Parsesdataas a message ofMessageType.TparseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)Parsesdataas a message ofMessageType.TparsePartialDelimitedFrom(InputStream input)LikeParser.parseDelimitedFrom(InputStream), but does not throw an exception if the message is missing required fields.TparsePartialDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)LikeParser.parseDelimitedFrom(InputStream, ExtensionRegistryLite), but does not throw an exception if the message is missing required fields.TparsePartialFrom(byte[] data)LikeParser.parseFrom(byte[]), but does not throw an exception if the message is missing required fields.TparsePartialFrom(byte[] data, int off, int len)LikeParser.parseFrom(byte[], int, int), but does not throw an exception if the message is missing required fields.TparsePartialFrom(byte[] data, int off, int len, ExtensionRegistryLite extensionRegistry)LikeParser.parseFrom(ByteString, ExtensionRegistryLite), but does not throw an exception if the message is missing required fields.TparsePartialFrom(byte[] data, ExtensionRegistryLite extensionRegistry)LikeParser.parseFrom(byte[], ExtensionRegistryLite), but does not throw an exception if the message is missing required fields.TparsePartialFrom(ByteString data)LikeParser.parseFrom(ByteString), but does not throw an exception if the message is missing required fields.TparsePartialFrom(ByteString data, ExtensionRegistryLite extensionRegistry)LikeParser.parseFrom(ByteString, ExtensionRegistryLite), but does not throw an exception if the message is missing required fields.TparsePartialFrom(CodedInputStream input)LikeParser.parseFrom(CodedInputStream), but does not throw an exception if the message is missing required fields.TparsePartialFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)LikeParser.parseFrom(CodedInputStream input, ExtensionRegistryLite), but does not throw an exception if the message is missing required fields.TparsePartialFrom(InputStream input)LikeParser.parseFrom(InputStream), but does not throw an exception if the message is missing required fields.TparsePartialFrom(InputStream input, ExtensionRegistryLite extensionRegistry)LikeParser.parseFrom(InputStream, ExtensionRegistryLite), but does not throw an exception if the message is missing required fields.
-
-
-
Constructor Detail
-
MicroEJParser
public MicroEJParser(T defaultInstance)
Creates a parser for the type of the given default instance.- Parameters:
defaultInstance- the default instance of the message type to read.
-
-
Method Detail
-
parseFrom
public T parseFrom(CodedInputStream input) throws InvalidProtocolBufferException
Description copied from interface:ParserParses a message ofMessageTypefrom 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.- Specified by:
parseFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parseFrom
public T parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
Description copied from interface:ParserLikeParser.parseFrom(CodedInputStream), but also parses extensions. The extensions that you want to be able to parse must be registered inextensionRegistry. Extensions not in the registry will be treated as unknown fields.- Specified by:
parseFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parsePartialFrom
public T parsePartialFrom(CodedInputStream input) throws InvalidProtocolBufferException
Description copied from interface:ParserLikeParser.parseFrom(CodedInputStream), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.- Specified by:
parsePartialFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parsePartialFrom
public T parsePartialFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
Description copied from interface:ParserLikeParser.parseFrom(CodedInputStream input, ExtensionRegistryLite), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.- Specified by:
parsePartialFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parseFrom
public T parseFrom(ByteBuffer data) throws InvalidProtocolBufferException
Description copied from interface:ParserParsesdataas a message ofMessageType. This is just a small wrapper aroundParser.parseFrom(CodedInputStream).- Specified by:
parseFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parseFrom
public T parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
Description copied from interface:ParserParsesdataas a message ofMessageType. This is just a small wrapper aroundParser.parseFrom(CodedInputStream, ExtensionRegistryLite).- Specified by:
parseFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parseFrom
public T parseFrom(ByteString data) throws InvalidProtocolBufferException
Description copied from interface:ParserParsesdataas a message ofMessageType. This is just a small wrapper aroundParser.parseFrom(CodedInputStream).- Specified by:
parseFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parseFrom
public T parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
Description copied from interface:ParserParsesdataas a message ofMessageType. This is just a small wrapper aroundParser.parseFrom(CodedInputStream, ExtensionRegistryLite).- Specified by:
parseFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parsePartialFrom
public T parsePartialFrom(ByteString data) throws InvalidProtocolBufferException
Description copied from interface:ParserLikeParser.parseFrom(ByteString), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.- Specified by:
parsePartialFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parsePartialFrom
public T parsePartialFrom(ByteString data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
Description copied from interface:ParserLikeParser.parseFrom(ByteString, ExtensionRegistryLite), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.- Specified by:
parsePartialFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parseFrom
public T parseFrom(byte[] data, int off, int len) throws InvalidProtocolBufferException
Description copied from interface:ParserParsesdataas a message ofMessageType. This is just a small wrapper aroundParser.parseFrom(CodedInputStream).- Specified by:
parseFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parseFrom
public T parseFrom(byte[] data, int off, int len, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
Description copied from interface:ParserParsesdataas a message ofMessageType. This is just a small wrapper aroundParser.parseFrom(CodedInputStream, ExtensionRegistryLite).- Specified by:
parseFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parseFrom
public T parseFrom(byte[] data) throws InvalidProtocolBufferException
Description copied from interface:ParserParsesdataas a message ofMessageType. This is just a small wrapper aroundParser.parseFrom(CodedInputStream).- Specified by:
parseFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parseFrom
public T parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
Description copied from interface:ParserParsesdataas a message ofMessageType. This is just a small wrapper aroundParser.parseFrom(CodedInputStream, ExtensionRegistryLite).- Specified by:
parseFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parsePartialFrom
public T parsePartialFrom(byte[] data, int off, int len) throws InvalidProtocolBufferException
Description copied from interface:ParserLikeParser.parseFrom(byte[], int, int), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.- Specified by:
parsePartialFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parsePartialFrom
public T parsePartialFrom(byte[] data, int off, int len, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
Description copied from interface:ParserLikeParser.parseFrom(ByteString, ExtensionRegistryLite), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.- Specified by:
parsePartialFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parsePartialFrom
public T parsePartialFrom(byte[] data) throws InvalidProtocolBufferException
Description copied from interface:ParserLikeParser.parseFrom(byte[]), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.- Specified by:
parsePartialFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parsePartialFrom
public T parsePartialFrom(byte[] data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
Description copied from interface:ParserLikeParser.parseFrom(byte[], ExtensionRegistryLite), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.- Specified by:
parsePartialFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parseFrom
public T parseFrom(InputStream input) throws InvalidProtocolBufferException
Description copied from interface:ParserParse a message ofMessageTypefrominput. This is just a small wrapper aroundParser.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, useMessageLite.writeDelimitedTo(java.io.OutputStream)to write your message andParser.parseDelimitedFrom(InputStream)to read it.Despite usually reading the entire input, this does not close the stream.
- Specified by:
parseFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parseFrom
public T parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
Description copied from interface:ParserParses a message ofMessageTypefrominput. This is just a small wrapper aroundParser.parseFrom(CodedInputStream, ExtensionRegistryLite).- Specified by:
parseFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parsePartialFrom
public T parsePartialFrom(InputStream input) throws InvalidProtocolBufferException
Description copied from interface:ParserLikeParser.parseFrom(InputStream), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.- Specified by:
parsePartialFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parsePartialFrom
public T parsePartialFrom(InputStream input, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
Description copied from interface:ParserLikeParser.parseFrom(InputStream, ExtensionRegistryLite), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.- Specified by:
parsePartialFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parseDelimitedFrom
public T parseDelimitedFrom(InputStream input) throws InvalidProtocolBufferException
Description copied from interface:ParserLikeParser.parseFrom(InputStream), but does not read until EOF. Instead, the size of message (encoded as a varint) is read first, then the message data. UseMessageLite.writeDelimitedTo(java.io.OutputStream)to write messages in this format.- Specified by:
parseDelimitedFromin interfaceParser<T extends MicroEJMessageLite>- Returns:
- Parsed message if successful, or null 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
public T parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
Description copied from interface:ParserLikeParser.parseDelimitedFrom(InputStream)but supporting extensions.- Specified by:
parseDelimitedFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parsePartialDelimitedFrom
public T parsePartialDelimitedFrom(InputStream input) throws InvalidProtocolBufferException
Description copied from interface:ParserLikeParser.parseDelimitedFrom(InputStream), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.- Specified by:
parsePartialDelimitedFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
parsePartialDelimitedFrom
public T parsePartialDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
Description copied from interface:ParserLikeParser.parseDelimitedFrom(InputStream, ExtensionRegistryLite), but does not throw an exception if the message is missing required fields. Instead, a partial message is returned.- Specified by:
parsePartialDelimitedFromin interfaceParser<T extends MicroEJMessageLite>- Throws:
InvalidProtocolBufferException
-
-