/** * Determine if the primary and sub type of this object is * the same as the content type described in rawdata. * * @param rawdata the MIME type string to compare with * @return true if they match */ public boolean match(String rawdata) throws MimeTypeParseException { return match(new MimeType(rawdata)); }
/** * Is the string representation of the MIME type passed in equivalent * to the MIME type of this DataFlavor. <p> * * ActivationDataFlavor delegates the comparison of MIME types to * the MimeType class included as part of the JavaBeans Activation * Framework. This provides a more robust comparison than is normally * available in the DataFlavor class. * * @param mimeType the MIME type * @return true if the same MIME type */ public boolean isMimeTypeEqual(String mimeType) { MimeType mt = null; try { if (mimeObject == null) mimeObject = new MimeType(this.mimeType); mt = new MimeType(mimeType); } catch (MimeTypeParseException e) { // something didn't parse, do a crude comparison return this.mimeType.equalsIgnoreCase(mimeType); } return mimeObject.match(mt); }
/** * Determine if the primary and sub type of this object is * the same as the content type described in rawdata. * * @param rawdata the MIME type string to compare with * @return true if they match */ public boolean match(String rawdata) throws MimeTypeParseException { return match(new MimeType(rawdata)); }
/** * Is the string representation of the MIME type passed in equivalent * to the MIME type of this DataFlavor. <p> * * ActivationDataFlavor delegates the comparison of MIME types to * the MimeType class included as part of the JavaBeans Activation * Framework. This provides a more robust comparison than is normally * available in the DataFlavor class. * * @param mimeType the MIME type * @return true if the same MIME type */ public boolean isMimeTypeEqual(String mimeType) { MimeType mt = null; try { if (mimeObject == null) mimeObject = new MimeType(this.mimeType); mt = new MimeType(mimeType); } catch (MimeTypeParseException e) {} return mimeObject.match(mt); }
private App getPreferredApplication(final MimeType type) { if (pref.containsKey(type)) { return pref.get(type); } for (final Map.Entry<MimeType, App> entry : pref.entrySet()) { if (type.match(entry.getKey())) { return entry.getValue(); } } return null; }
/** * Determine if the primary and sub type of this object is * the same as the content type described in rawdata. * * @param rawdata the MIME type string to compare with * @return true if they match * @exception MimeTypeParseException if the MIME type can't be parsed */ public boolean match(String rawdata) throws MimeTypeParseException { return match(new MimeType(rawdata)); }
/** * Determine if the primary and sub type of this object is * the same as the content type described in rawdata. * * @param rawdata the MIME type string to compare with * @return true if they match */ public boolean match(String rawdata) throws MimeTypeParseException { return match(new MimeType(rawdata)); }
/** * Determine if the primary and sub type of this object is * the same as the content type described in rawdata. * * @param rawdata the MIME type string to compare with * @return true if they match * @exception MimeTypeParseException if the MIME type can't be parsed */ public boolean match(String rawdata) throws MimeTypeParseException { return match(new MimeType(rawdata)); }
/** * Determine if the primary and sub type of this object is * the same as the content type described in rawdata. * * @param rawdata the MIME type string to compare with * @return true if they match */ public boolean match(String rawdata) throws MimeTypeParseException { return match(new MimeType(rawdata)); }
private List<App> getApplications(final MimeType type) { final List<App> apps = new ArrayList<>(); if (appsByType.containsKey(type)) { apps.addAll(appsByType.get(type)); } for (final Map.Entry<MimeType, List<App>> entry : appsByType.entrySet()) { if (type.match(entry.getKey())) { final List<App> s = new ArrayList<>(entry.getValue()); s.removeAll(apps); apps.addAll(s); } } return Collections.unmodifiableList(apps); }
/** * Determine if the primary and sub type of this object is * the same as the content type described in rawdata. * * @param rawdata the MIME type string to compare with * @return true if they match * @exception MimeTypeParseException if the MIME type can't be parsed */ public boolean match(String rawdata) throws MimeTypeParseException { return match(new MimeType(rawdata)); }
public boolean match(String rawdata) throws MimeTypeParseException { return match(new MimeType(rawdata)); }
/** * Determine if the primary and sub type of this object is * the same as the content type described in rawdata. * * @param rawdata the MIME type string to compare with * @return true if they match * @exception MimeTypeParseException if the MIME type can't be parsed */ public boolean match(String rawdata) throws MimeTypeParseException { return match(new MimeType(rawdata)); }
public final boolean canOpen(final MimeType t) { for (final String s : type.split(":")) try { if (t.match(s)) { return true; } } catch (final MimeTypeParseException ex) { ex.printStackTrace(); } return false; }
public boolean match(String rawdata) throws MimeTypeParseException { return match(new MimeType(rawdata)); }
public boolean match(String rawdata) throws MimeTypeParseException { return match(new MimeType(rawdata)); }
public Converter getConverter(MimeType requestedForm) { if (requestedForm != null) { for (Converter converter : getConverters()) { if (requestedForm.match(converter.getMimeType()) && converter.getApiVersions().contains(restApiVersion)) return converter; } } throw new RuntimeException("Converter not found"); }
public boolean isMimeTypeEqual(String mimeType) { try { MimeType thisType = new MimeType(this.mimeType); MimeType thatType = new MimeType(mimeType); return thisType.match(thatType); } catch (MimeTypeParseException e) { return false; } }
public boolean isMimeTypeEqual(String mimeType) { try { MimeType thisType = new MimeType(this.mimeType); MimeType thatType = new MimeType(mimeType); return thisType.match(thatType); } catch (MimeTypeParseException e) { return false; } }
public boolean isMimeTypeEqual(String mimeType) { try { MimeType thisType = new MimeType(this.mimeType); MimeType thatType = new MimeType(mimeType); return thisType.match(thatType); } catch (MimeTypeParseException e) { return false; } }