Package com.google.protobuf

# Class DiscardUnknownFieldsParser

java.lang.Object
com.google.protobuf.DiscardUnknownFieldsParser

public final class DiscardUnknownFieldsParser extends Object
Parsers to discard unknown fields during parsing.

## Method Summary

Modifier and Type
Method
Description
`static final <T extends Message>
Parser<T>`
`wrap(Parser<T> parser)`
Wraps a given `Parser` into a new `Parser` that discards unknown fields during parsing.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### wrap

public static final <T extends Message> Parser<T> wrap(Parser<T> parser)
Wraps a given `Parser` into a new `Parser` that discards unknown fields during parsing.

Usage example:

     private final static Parser<Foo> FOO_PARSER = DiscardUnknownFieldsParser.wrap(Foo.parser());
     Foo parseFooDiscardUnknown(ByteBuffer input) throws IOException {
       return FOO_PARSER.parseFrom(input);
     }

Like all other implementations of `Parser`, this parser is stateless and thread-safe.

Parameters:
  `parser` - The delegated parser that parses messages.
Returns:
  a `Parser` that will discard unknown fields during parsing.