public class NameDetector extends java.lang.Object implements Detector
If a pattern matches the given name, then the media type associated with
that pattern is returned as the likely content type of the input document.
Otherwise the returned type is
detect(InputStream, Metadata) method for more details
of the matching algorithm.
|Constructor and Description|
Creates a new content type detector based on the given name patterns.
|Modifier and Type||Method and Description|
Detects the content type of an input document based on the document name given in the input metadata.
public NameDetector(java.util.Map<java.util.regex.Pattern,MediaType> patterns)
patterns- map from name patterns to corresponding media types
If a resource name is given, then it is first processed as follows.
The resulting name string (if any) is then matched in sequence against all the configured name patterns. If a match is found, then the (first) matching media type is returned.
Copyright © 2010 - 2020 Adobe. All Rights Reserved