Package org.apache.tika.mime

Examples of org.apache.tika.mime.MediaTypeRegistry.normalize()


        registry.addSuperType(new MediaType("text", "csv"), new MediaType(
            "text", "plain"));
        MediaType parsedType = MediaType.parse(metadata
            .get(Metadata.CONTENT_TYPE));
   
        if (registry.isSpecializationOf(registry.normalize(type), registry
            .normalize(parsedType).getBaseType())) {
          metadata.set(Metadata.CONTENT_TYPE, type.toString());
        }
        logger.info("Detected " + metadata.get(Metadata.CONTENT_TYPE));
        inputType = getInputType(metadata);
View Full Code Here


        registry.addSuperType(new MediaType("text", "csv"), new MediaType(
            "text", "plain"));
        MediaType parsedType = MediaType.parse(metadata
            .get(Metadata.CONTENT_TYPE));
   
        if (registry.isSpecializationOf(registry.normalize(type), registry
            .normalize(parsedType).getBaseType())) {
          metadata.set(Metadata.CONTENT_TYPE, type.toString());
        }
        logger.info("Detected " + metadata.get(Metadata.CONTENT_TYPE));
        inputType = getInputType(metadata);
View Full Code Here

            // Add dynamic parser service (they always override static ones)
            MediaTypeRegistry registry = getMediaTypeRegistry();
            for (Parser parser
                    : loader.loadDynamicServiceProviders(Parser.class)) {
                for (MediaType type : parser.getSupportedTypes(context)) {
                    map.put(registry.normalize(type), parser);
                }
            }
        }

        return map;
View Full Code Here

            List<Parser> parsers =
                    loader.loadDynamicServiceProviders(Parser.class);
            Collections.reverse(parsers); // best parser last
            for (Parser parser : parsers) {
                for (MediaType type : parser.getSupportedTypes(context)) {
                    map.put(registry.normalize(type), parser);
                }
            }
        }

        return map;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.