org.apache.tika.detect
Class TypeDetector

java.lang.Object
  extended by org.apache.tika.detect.TypeDetector
All Implemented Interfaces:
Serializable, Detector

public class TypeDetector
extends Object
implements Detector

Content type detection based on a content type hint. This detector simply trusts any valid content type hint given in the input metadata, and returns that as the likely type of the input document.

Since:
Apache Tika 0.3
See Also:
Serialized Form

Constructor Summary
TypeDetector()
           
 
Method Summary
 MediaType detect(InputStream input, Metadata metadata)
          Detects the content type of an input document based on a type hint given in the input metadata.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeDetector

public TypeDetector()
Method Detail

detect

public MediaType detect(InputStream input,
                        Metadata metadata)
Detects the content type of an input document based on a type hint given in the input metadata. The CONTENT_TYPE attribute of the given input metadata is expected to contain the type of the input document. If that attribute exists and contains a valid type name, then that type is returned.

Specified by:
detect in interface Detector
Parameters:
input - ignored
metadata - input metadata, possibly with a CONTENT_TYPE value
Returns:
detected media type, or application/octet-stream


Copyright © 2007-2012 The Apache Software Foundation. All Rights Reserved.