/** * Returns a mime type for the given type and subtype, e. g. <code>video/mj2</code>. * * @param mimeType * the mime type * @return the corresponding mime type */ public static MimeType parseMimeType(String mimeType) { final Matcher m = MIME_TYPE_PATTERN.matcher(mimeType); if (!m.matches()) throw new IllegalArgumentException("Malformed mime type '" + mimeType + "'"); final String type = m.group(1); final String subtype = m.group(2); for (MimeType t : mimeTypes) { if (t.getType().equals(type) && t.getSubtype().equals(subtype)) return t; } return mimeType(type, subtype); }
/** Get a mime type from the registry. */ public static Option<MimeType> get(String type, String subtype) { for (MimeType t : mimeTypes) { if (t.getType().equals(type) && t.getSubtype().equals(subtype)) return some(t); } return none(); }
/** Two mime types are considered equal if type and subtype are equal. */ public boolean eq(MimeType other) { return eq(other.getType(), other.getSubtype()); }
mimeType = MimeTypes.parseMimeType("video/" + mimeType.getSubtype()); } else if ("video".equals(mimeType.getType()) && !metadata.hasVideoStreamMetadata()) { mimeType = MimeTypes.parseMimeType("audio/" + mimeType.getSubtype());
mimeType = MimeTypes.parseMimeType("video/" + mimeType.getSubtype()); } else if ("video".equals(mimeType.getType()) && !metadata.hasVideoStreamMetadata()) { mimeType = MimeTypes.parseMimeType("audio/" + mimeType.getSubtype());