Home » openjdk-7 » javax » print » [javadoc | source]
javax.print
class: MimeType [javadoc | source]
java.lang.Object
   javax.print.MimeType

All Implemented Interfaces:
    Cloneable, java$io$Serializable

Class MimeType encapsulates a Multipurpose Internet Mail Extensions (MIME) media type as defined in RFC 2045 and RFC 2046. A MIME type object is part of a DocFlavor object and specifies the format of the print data.

Class MimeType is similar to the like-named class in package java.awt.datatransfer . Class java.awt.datatransfer.MimeType is not used in the Jini Print Service API for two reasons:

  1. Since not all Java profiles include the AWT, the Jini Print Service should not depend on an AWT class.

  2. The implementation of class java.awt.datatransfer.MimeType does not guarantee that equivalent MIME types will have the same serialized representation. Thus, since the Jini Lookup Service (JLUS) matches service attributes based on equality of serialized representations, JLUS searches involving MIME types encapsulated in class java.awt.datatransfer.MimeType may incorrectly fail to match.

Class MimeType's serialized representation is based on the following canonical form of a MIME type string. Thus, two MIME types that are not identical but that are equivalent (that have the same canonical form) will be considered equal by the JLUS's matching algorithm.

Constructor:
 public MimeType(String s) 
    Construct a new MIME type object from the given string. The given string is converted into canonical form and stored internally.
    Parameters:
    s - MIME media type string.
    Throws:
    NullPointerException - (unchecked exception) Thrown if s is null.
    IllegalArgumentException - (unchecked exception) Thrown if s does not obey the syntax for a MIME media type string.
    exception: NullPointerException - (unchecked exception) Thrown if s is null.
    exception: IllegalArgumentException - (unchecked exception) Thrown if s does not obey the syntax for a MIME media type string.
Method from javax.print.MimeType Summary:
equals,   getMediaSubtype,   getMediaType,   getMimeType,   getParameterMap,   hashCode,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.print.MimeType Detail:
 public boolean equals(Object obj) 
    Determine if this MIME type object is equal to the given object. The two are equal if the given object is not null, is an instance of class net.jini.print.data.MimeType, and has the same canonical form as this MIME type object (that is, has the same type, subtype, and parameters). Thus, if two MIME type objects are the same except for comments, they are considered equal. However, "text/plain" and "text/plain; charset=us-ascii" are not considered equal, even though they represent the same media type (because the default character set for plain text is US-ASCII).
 public String getMediaSubtype() 
    Returns this MIME type object's media subtype.
 public String getMediaType() 
    Returns this MIME type object's media type.
 public String getMimeType() 
    Returns this MIME type object's MIME type string based on the canonical form. Each parameter value is enclosed in quotes.
 public Map getParameterMap() 
    Returns an unmodifiable map view of the parameters in this MIME type object. Each entry in the parameter map view consists of a parameter name String (key) mapping to a parameter value String. If this MIME type object has no parameters, an empty map is returned.
 public int hashCode() 
    Returns a hash code for this MIME type object.
 public String toString() 
    Converts this MIME type object to a string.