PROXY  WHOIS  RQUOTE  TEXTS  SOFT  FOREX  BBOARD
 Music  Philosophy  Code  Literature  Russian

= ROOT|Technical|Code_Examples|Java|javax|print|DocFlavor.java =

page 6 of 15




    /**
     * Returns this doc flavor object's media type (from the MIME type). 
     * @return the media type
     */
    public String getMediaType() {
    	return myMimeType.getMediaType();
    }

    /**
     * Returns this doc flavor object's media subtype (from the MIME type). 
     * @return the media sub-type
     */
    public String getMediaSubtype() {
    	return myMimeType.getMediaSubtype();
    }

    /**
     * Returns a <code>String</code> representing a MIME
     * parameter.
     * Mime types may include parameters which are usually optional.
     * The charset for text types is a commonly useful example.
     * This convenience method will return the value of the specified
     * parameter if one was specified in the mime type for this flavor.
     * <p>
     * @param paramName the name of the paramater. This name is internally
     * converted to the canonical lower case format before performing
     * the match.
     * @return String representing a mime parameter, or
     * null if that parameter is not in the mime type string.
     * @exception throws NullPointerException if paramName is null.
     */
    public String getParameter(String paramName) {
	return
	    (String)myMimeType.getParameterMap().get(paramName.toLowerCase());
    }

    /**
     * Returns the name of this doc flavor object's representation class. 
     * @return the name of the representation class.
     */
    public String getRepresentationClassName() {
    	return myClassName;
    }

    /**
     * Converts this <code>DocFlavor</code> to a string.
     *
     * @return  MIME type string based on the canonical form. Each parameter 
     *          value is enclosed in quotes. 
     *          A "class=" parameter is appended to the
     *          MIME type string to indicate the representation class name. 
     */
    public String toString() {
    	return getStringValue();
    }

    /**
     * Returns a hash code for this doc flavor object.
     */
    public int hashCode() {
    	return getStringValue().hashCode();
    }

    /**
     * Determines if this doc flavor object is equal to the given object.
     * The two are equal if the given object is not null, is an instance
     * of <code>DocFlavor</code>, has a MIME type equivalent to this doc 
     * flavor object's MIME type (that is, the MIME types have the same media 
     * type, media subtype, and parameters), and has the same representation 
     * class name as this doc flavor object. Thus, if two doc flavor objects' 
     * MIME types are the same except for comments, they are considered equal. 
     * However, two doc flavor objects with MIME types of "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). 
     *
     * @param  obj  Object to test.
     *
     * @return  True if this doc flavor object equals <CODE>obj</CODE>, false
     *          otherwise. 
     */
    public boolean equals(Object obj) {
    	return
	    obj != null &&
	    obj instanceof DocFlavor &&
	    getStringValue().equals (((DocFlavor) obj).getStringValue());
    }

    /**
     * Returns this doc flavor object's string value. 
     */
    private String getStringValue() {
    	if (myStringValue == null) {
	    myStringValue = myMimeType + "; class=\"" + myClassName + "\"";
	}
    	return myStringValue;
    }

    /**
=6=

1|2|3|4|5| < PREV = PAGE 6 = NEXT > |7|8|9|10|11|12|13|14|15

UP TO ROOT | UP TO DIR | TO FIRST PAGE

Google
 


E-mail Facebook Google Digg del.icio.us BlinkList Fark Furl Ma.gnolia Netscape NewsVine Reddit Slashdot Spurl StumbleUpon Technorati YahooMyWeb LiveJournal Blogmarks TwitThis Live News2.ru BobrDobr.ru Memori.ru MoeMesto.ru

0.0113461 wallclock secs ( 0.01 usr + 0.00 sys = 0.01 CPU)