Package org.apache.tika.mime

Examples of org.apache.tika.mime.MediaTypeRegistry


*/
public class CompositeExternalParser extends CompositeParser {
   private static final long serialVersionUID = 6962436916649024024L;

   public CompositeExternalParser() throws IOException, TikaException {
      this(new MediaTypeRegistry());
   }
View Full Code Here


    public CompositeParser(MediaTypeRegistry registry, Parser... parsers) {
        this(registry, Arrays.asList(parsers));
    }

    public CompositeParser() {
        this(new MediaTypeRegistry());
    }
View Full Code Here

            }
        }
        if (parsers.isEmpty()) {
            return getDefaultParser(mimeTypes, loader);
        } else {
            MediaTypeRegistry registry = mimeTypes.getMediaTypeRegistry();
            return new CompositeParser(registry, parsers);
        }
    }
View Full Code Here

           }
       }
       if (detectors.isEmpty()) {
           return getDefaultDetector(mimeTypes, loader);
       } else {
           MediaTypeRegistry registry = mimeTypes.getMediaTypeRegistry();
           return new CompositeDetector(registry, detectors);
       }
    }
View Full Code Here

        this.registry = registry;
        this.detectors = detectors;
    }

    public CompositeDetector(List<Detector> detectors) {
        this(new MediaTypeRegistry(), detectors);
    }
View Full Code Here

    /**
     * Prints all the known media types, aliases and matching parser classes.
     */
    private void displaySupportedTypes() {
        AutoDetectParser parser = new AutoDetectParser();
        MediaTypeRegistry registry = parser.getMediaTypeRegistry();
        Map<MediaType, Parser> parsers = parser.getParsers();

        for (MediaType type : registry.getTypes()) {
            System.out.println(type);
            for (MediaType alias : registry.getAliases(type)) {
                System.out.println("  alias:     " + alias);
            }
            MediaType supertype = registry.getSupertype(type);
            if (supertype != null) {
                System.out.println("  supertype: " + supertype);
            }
            Parser p = parsers.get(type);
            if (p != null) {
View Full Code Here

    /**
     * Prints all the known media types, aliases and matching parser classes.
     */
    private void displaySupportedTypes() {
        MediaTypeRegistry registry = parser.getMediaTypeRegistry();
        Map<MediaType, Parser> parsers = parser.getParsers();

        for (MediaType type : registry.getTypes()) {
            System.out.println(type);
            for (MediaType alias : registry.getAliases(type)) {
                System.out.println("  alias:     " + alias);
            }
            MediaType supertype = registry.getSupertype(type);
            if (supertype != null) {
                System.out.println("  supertype: " + supertype);
            }
            Parser parser = parsers.get(type);
            if (parser != null) {
View Full Code Here

    /** Serial version UID */
    private static final long serialVersionUID = 3612324825403757520L;

    private DefaultParser(ServiceLoader loader) {
        super(new MediaTypeRegistry(),
                loader.loadServiceProviders(Parser.class));
    }
View Full Code Here

    public CompositeParser(MediaTypeRegistry registry, Parser... parsers) {
        this(registry, Arrays.asList(parsers));
    }

    public CompositeParser() {
        this(new MediaTypeRegistry());
    }
View Full Code Here

        return text.toString();
    }
   
    protected List<MediaTypeDetails> getMediaTypes() {
        MediaTypeRegistry registry = tika.getMediaTypeRegistry();
        Map<MediaType, Parser> parsers = ((CompositeParser)tika.getParser()).getParsers();
        List<MediaTypeDetails> types =
                new ArrayList<TikaMimeTypes.MediaTypeDetails>(registry.getTypes().size());

        for (MediaType type : registry.getTypes()) {
            MediaTypeDetails details = new MediaTypeDetails();
            details.type = type;
            details.aliases = registry.getAliases(type).toArray(new MediaType[0]);
           
            MediaType supertype = registry.getSupertype(type);
            if (supertype != null && !MediaType.OCTET_STREAM.equals(supertype)) {
                details.supertype = supertype;
            }
           
            Parser p = parsers.get(type);
View Full Code Here

TOP

Related Classes of org.apache.tika.mime.MediaTypeRegistry

Copyright © 2018 www.massapicom. 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.