public static final Parser withTypes(Parser parser, final Set<MediaType> types) {
        return new ParserDecorator(parser) {
            private static final long serialVersionUID = -7345051519565330731L;

            @Override
            public Set<MediaType> getSupportedTypes(ParseContext context) {
                return types;
            }

            @Override
            public String getDecorationName() {
                return "With Types";
            }
        };
    }
Decorates the given parser so that it always claims to support
parsing of the given media types.

@param parser the parser to be decorated
@param types  supported media types
@return the decorated parser
tika-core/src/main/java/org/apache/tika/parser/ParserDecorator.java