集册 Java实例教程 指示mime是否

指示mime是否

欢马劈雪     最近更新时间:2020-01-02 10:19:05

419
指示mime类型是否表示包含html或xhtml的文档。

/**
n o w  j a v a  . c o m
**/

//package com.nowjava;


public class Main {

    /**

     * Indicates whether a mime-type represents an document containing html

     * or xhtml.

     * @param mimeType

     * @return true if mime-type represents a html document.

     */

    public static boolean isHTML(String mimeType) {

        if (mimeType.equals("text/html")

                || mimeType.equals("application/xhtml+xml")) {

            return true;

        }

        return false;

    }

}