Search in sources :

Example 1 with Builder

use of org.apache.tika.mime.ProbabilisticMimeDetectionSelector.Builder in project tika by apache.

the class ProbabilisticMimeDetectionTestWithTika method setUp.

/** @inheritDoc */
@Before
public void setUp() {
    MimeTypes types = MimeTypes.getDefaultMimeTypes();
    ServiceLoader loader = new ServiceLoader();
    registry = types.getMediaTypeRegistry();
    /*
         * here is an example with the use of the builder to
         * instantiate the object.
         */
    Builder builder = new ProbabilisticMimeDetectionSelector.Builder();
    proSelector = new ProbabilisticMimeDetectionSelector(types, builder.priorMagicFileType(0.5f).priorExtensionFileType(0.5f).priorMetaFileType(0.5f));
    DefaultProbDetector detector = new DefaultProbDetector(proSelector, loader);
    // Use a default Tika, except for our different detector
    tika = new Tika(detector);
}
Also used : ServiceLoader(org.apache.tika.config.ServiceLoader) Builder(org.apache.tika.mime.ProbabilisticMimeDetectionSelector.Builder) DefaultProbDetector(org.apache.tika.detect.DefaultProbDetector) Tika(org.apache.tika.Tika) Before(org.junit.Before)

Aggregations

Tika (org.apache.tika.Tika)1 ServiceLoader (org.apache.tika.config.ServiceLoader)1 DefaultProbDetector (org.apache.tika.detect.DefaultProbDetector)1 Builder (org.apache.tika.mime.ProbabilisticMimeDetectionSelector.Builder)1 Before (org.junit.Before)1