/*
* @(#)MimeType.java 1.7 05/11/17
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package javax.print;
import java.io.Serializable;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.Vector;
/**
* Class MimeType encapsulates a Multipurpose Internet Mail Extensions (MIME)
* media type as defined in <A HREF="http://www.ietf.org/rfc/rfc2045.txt">RFC
* 2045</A> and <A HREF="http://www.ietf.org/rfc/rfc2046.txt">RFC 2046</A>. A
* MIME type object is part of a {@link DocFlavor DocFlavor} object and
* specifies the format of the print data.
* <P>
* Class MimeType is similar to the like-named
* class in package {@link java.awt.datatransfer java.awt.datatransfer}. Class
* java.awt.datatransfer.MimeType is not used in the Jini Print Service API
* for two reasons:
* <OL TYPE=1>
* <LI>
* Since not all Java profiles include the AWT, the Jini Print Service should
* not depend on an AWT class.
* <P>
* <LI>
* 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.
* </OL>
* <P>
* 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.
* <UL>
* <LI> The media type, media subtype, and parameters are retained, but all
* comments and whitespace characters are discarded.
* <LI> The media type, media subtype, and parameter names are converted to
* lowercase.
* <LI> The parameter values retain their original case, except a charset
* parameter value for a text media type is converted to lowercase.
* <LI> Quote characters surrounding parameter values are removed.
* <LI> Quoting backslash characters inside parameter values are removed.
* <LI> The parameters are arranged in ascending order of parameter name.
* </UL>
* <P>
*
* @author Alan Kaminsky
*/
class MimeType implements Serializable, Cloneable {
private static final long serialVersionUID = -2785720609362367683L;
/**
* Array of strings that hold pieces of this MIME type's canonical form.
* If the MIME type has <I>n</I> parameters, <I>n</I> >= 0, then the
* strings in the array are:
* <BR>Index 0 -- Media type.
* <BR>Index 1 -- Media subtype.
* <BR>Index 2<I>i</I>+2 -- Name of parameter <I>i</I>,
* <I>i</I>=0,1,...,<I>n</I>-1.
* <BR>Index 2<I>i</I>+3 -- Value of parameter <I>i</I>,
* <I>i</I>=0,1,...,<I>n</I>-1.
* <BR>Parameters are arranged in ascending order of parameter name.
* @serial
*/
private String[] myPieces;
/**
* String value for this MIME type. Computed when needed and cached.
*/
private transient String myStringValue = null;
/**
* Parameter map entry set. Computed when needed and cached.
*/
private transient ParameterMapEntrySet myEntrySet = null;
/**
* Parameter map. Computed when needed and cached.
*/
private transient ParameterMap myParameterMap = null;
/**
* Parameter map entry.
=1= |