/** * Constructs a <code>DataFlavor</code> that represents a <code>MimeType</code>. * * <p>The returned <code>DataFlavor</code> will have the following characteristics: * * <p>If the <code>mimeType</code> is "application/x-java-serialized-object; * class=<representation class>", the result is the same as calling <code> * new DataFlavor(Class:forName(<representation class>)</code>. * * <p>Otherwise: * * <pre> * representationClass = InputStream * mimeType = mimeType * </pre> * * @param mimeType the string used to identify the MIME type for this flavor; if the the <code> * mimeType</code> does not specify a "class=" parameter, or if the class is not successfully * loaded, then an <code>IllegalArgumentException</code> is thrown * @param humanPresentableName the human-readable string used to identify this flavor; if this * parameter is <code>null</code> then the value of the the MIME Content Type is used * @exception IllegalArgumentException if <code>mimeType</code> is invalid or if the class is not * successfully loaded * @exception NullPointerException if <code>mimeType</code> is null */ public DataFlavor(String mimeType, String humanPresentableName) { super(); if (mimeType == null) { throw new NullPointerException("mimeType"); } try { initialize(mimeType, humanPresentableName, this.getClass().getClassLoader()); } catch (MimeTypeParseException mtpe) { throw new IllegalArgumentException("failed to parse:" + mimeType); } catch (ClassNotFoundException cnfe) { throw new IllegalArgumentException("can't find specified class: " + cnfe.getMessage()); } }