Java Code Examples for org.apache.tika.mime.MediaType#getType()
The following examples show how to use
org.apache.tika.mime.MediaType#getType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HttpUtils.java From flink-crawler with Apache License 2.0 | 5 votes |
public static String getMimeTypeFromContentType(String contentType) { String result = ""; MediaType mt = MediaType.parse(contentType); if (mt != null) { result = mt.getType() + "/" + mt.getSubtype(); } return result; }
Example 2
Source File: BaseFetcher.java From ache with Apache License 2.0 | 5 votes |
protected static String getMimeTypeFromContentType(String contentType) { String result = ""; MediaType mt = MediaType.parse(contentType); if (mt != null) { result = mt.getType() + "/" + mt.getSubtype(); } return result; }
Example 3
Source File: MimeTypeUtils.java From oodt with Apache License 2.0 | 5 votes |
public String getSuperTypeForMimeType(String mimeType) { try { MediaType mediaType = this.mimeTypes.getMediaTypeRegistry().getSupertype(this.mimeTypes.forName(mimeType).getType()); if (mediaType != null) { return mediaType.getType() + "/" + mediaType.getSubtype(); } else { return null; } }catch (Exception e) { LOG.log(Level.WARNING, "Failed to get super-type for mimetype " + mimeType + " : " + e.getMessage()); return null; } }
Example 4
Source File: SolrCellBuilder.java From kite with Apache License 2.0 | 5 votes |
/** Returns true if mediaType falls withing the given range (pattern), false otherwise */ private boolean isMediaTypeMatch(MediaType mediaType, MediaType rangePattern) { String WILDCARD = "*"; String rangePatternType = rangePattern.getType(); String rangePatternSubtype = rangePattern.getSubtype(); return (rangePatternType.equals(WILDCARD) || rangePatternType.equals(mediaType.getType())) && (rangePatternSubtype.equals(WILDCARD) || rangePatternSubtype.equals(mediaType.getSubtype())); }