⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 contenttype.java

📁 Messaging- MIDP的是一个彩信客户端
💻 JAVA
字号:
/*
 *  JVending - J2ME MMS Client
 *  Copyright (C) 2004  Shane Isbell
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package org.jvending.messaging;

/**
 * Provides services for WSP content types. This implementation provides a limited set of content types. Since each
 * device supports different types of content, I have only included the most common types.
 *
 * See http://www.wapforum.org/wina/wsp-content-type.htm for a complete list.
 *
 * @author Shane Isbell
 * @version 1.0.0a
 * @created 04/03/27
 */

public final class ContentType {

    /**numeric id for text/plain content*/
    public static final int TEXT_PLAIN = 3;

    /**numeric id for image/gif content*/
    public static final int IMAGE_GIF = 29;

    /**numeric id for image/jpeg content*/
    public static final int IMAGE_JPEG = 30;

    /**numeric id for image/png content*/
    public static final int IMAGE_PNG = 32;

    /**numeric id for application/vnd.wap.multipart.mixed*/
    public static final int APPLICATION_WAP_MIXED = 35;

    /**
     * Returns the string representation of a ContentType.<content_type> value.
     *
     * @param type ContentType.<content_type> value
     * @return text version of WSP content type
     */
    public static final String intToString(int type) {
        switch(type) {
            case TEXT_PLAIN: return "text/plain";
            case IMAGE_GIF: return "image/gif";
            case IMAGE_JPEG: return "image/jpeg";
            case IMAGE_PNG: return "image/png";
            case APPLICATION_WAP_MIXED: return "application/vnd.wap.multipart.mixed";
            default: return null;
        }
    }

    public static final int stringToInt(String type) {
        if(type.equals("text/plain")) return TEXT_PLAIN;
        else if(type.equals("image/gif")) return IMAGE_GIF;
        else if(type.equals("image/jpeg")) return IMAGE_JPEG;
        else if(type.equals("image/png")) return IMAGE_PNG;
        else if(type.equals("application/vnd.wap.multipart.mixed")) return APPLICATION_WAP_MIXED;
        else return -1;
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -