diff options
Diffstat (limited to 'java/core/src/main/java/com/google/protobuf/Parser.java')
-rw-r--r-- | java/core/src/main/java/com/google/protobuf/Parser.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/java/core/src/main/java/com/google/protobuf/Parser.java b/java/core/src/main/java/com/google/protobuf/Parser.java index 3fa11c3b..e07c6895 100644 --- a/java/core/src/main/java/com/google/protobuf/Parser.java +++ b/java/core/src/main/java/com/google/protobuf/Parser.java @@ -30,8 +30,8 @@ package com.google.protobuf; -import java.io.IOException; import java.io.InputStream; +import java.nio.ByteBuffer; /** * Abstract interface for parsing Protocol Messages. @@ -40,7 +40,7 @@ import java.io.InputStream; * * <p>All methods may throw {@link InvalidProtocolBufferException}. In the event of invalid data, * like an encoding error, the cause of the thrown exception will be {@code null}. However, if an - * I/O problem occurs, an exception is thrown with an {@link IOException} cause. + * I/O problem occurs, an exception is thrown with an {@link java.io.IOException} cause. * * @author liujisi@google.com (Pherl Liu) */ @@ -94,6 +94,18 @@ public interface Parser<MessageType> { // Convenience methods. /** + * Parses {@code data} as a message of {@code MessageType}. This is just a small wrapper around + * {@link #parseFrom(CodedInputStream)}. + */ + public MessageType parseFrom(ByteBuffer data) throws InvalidProtocolBufferException; + + /** + * Parses {@code data} as a message of {@code MessageType}. This is just a small wrapper around + * {@link #parseFrom(CodedInputStream, ExtensionRegistryLite)}. + */ + public MessageType parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry) + throws InvalidProtocolBufferException; + /** * Parses {@code data} as a message of {@code MessageType}. * This is just a small wrapper around {@link #parseFrom(CodedInputStream)}. */ |