本文整理匯總了Java中org.apache.tika.parser.Parser.getSupportedTypes方法的典型用法代碼示例。如果您正苦於以下問題:Java Parser.getSupportedTypes方法的具體用法?Java Parser.getSupportedTypes怎麽用?Java Parser.getSupportedTypes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.tika.parser.Parser
的用法示例。
在下文中一共展示了Parser.getSupportedTypes方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testSupports
import org.apache.tika.parser.Parser; //導入方法依賴的package包/類
public void testSupports() throws Exception
{
ArrayList<String> mimeTypes = new ArrayList<String>();
for (Parser p : new Parser[] {
new OfficeParser(), new OpenDocumentParser(),
new Mp3Parser(), new OOXMLParser()
}) {
Set<MediaType> mts = p.getSupportedTypes(new ParseContext());
for (MediaType mt : mts)
{
mimeTypes.add(mt.toString());
}
}
for (String mimetype : mimeTypes)
{
boolean supports = extracter.isSupported(mimetype);
assertTrue("Mimetype should be supported: " + mimetype, supports);
}
}
示例2: setTikaParser
import org.apache.tika.parser.Parser; //導入方法依賴的package包/類
/**
* Injects the Tika parser to use
* @param tikaParser Parser
*/
public void setTikaParser(Parser tikaParser)
{
this.tikaParser = tikaParser;
// Build the mime types, updating the copy our parent
// holds for us as we go along
for(MediaType mt : tikaParser.getSupportedTypes(new ParseContext()))
{
super.sourceMimeTypes.add( mt.toString() );
}
}
示例3: setTikaParser
import org.apache.tika.parser.Parser; //導入方法依賴的package包/類
/**
* Injects the Tika parser to use
* @param tikaParser
*/
public void setTikaParser(Parser tikaParser)
{
this.tikaParser = tikaParser;
// Build the mime types, updating the copy our parent
// holds for us as we go along
ArrayList<String> mimetypes = new ArrayList<String>();
for(MediaType mt : tikaParser.getSupportedTypes(new ParseContext()))
{
mimetypes.add( mt.toString() );
}
super.setSupportedMimetypes(mimetypes);
}