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

📄 mimeinfo.java

📁 jxta-cms-src-2.4.zip 是官网上的比较稳定的CMS源代码。目前是最稳定的高版本。
💻 JAVA
字号:
/* * Copyright (c) 2001 Sun Microsystems, Inc.  All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in *    the documentation and/or other materials provided with the *    distribution. * * 3. The end-user documentation included with the redistribution, *    if any, must include the following acknowledgment: *       "This product includes software developed by the *       Sun Microsystems, Inc. for Project JXTA." *    Alternately, this acknowledgment may appear in the software itself, *    if and wherever such third-party acknowledgments normally appear. * * 4. The names "Sun", "Sun Microsystems, Inc.", "JXTA" and "Project JXTA" must *    not be used to endorse or promote products derived from this *    software without prior written permission. For written *    permission, please contact Project JXTA at http://www.jxta.org. * * 5. Products derived from this software may not be called "JXTA", *    nor may "JXTA" appear in their name, without prior written *    permission of Sun. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * *==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of Project JXTA.  For more * information on Project JXTA, please see * <http://www.jxta.org/>. * * This license is based on the BSD license adopted by the Apache Foundation. * * $Id: MimeInfo.java,v 1.4 2005/05/12 16:20:10 hamada Exp $ * */package net.jxta.share;/** * The MimeInfo class represents information about a specific mime type. */public class MimeInfo {    private String type;     // mime type    private String description;     // description    private String[] extensions;    // file extensions    private String action;     // default action    private String icon;     // icon name    private String application;     // launcher application    /**     * Creates a new MimeInfo object for the specified mime type.     */    public MimeInfo(String type) {        this.type = type;    }    /**     * Returns the major type for this mime type.     */    public String getType() {        return type;    }    /**     * Sets the description for this mime type.     */    public void setDescription(String desc) {        description = desc;    }    /**     * Returns the description for this mime type, or null if none.     */    public String getDescription() {        return description;    }    /**     * Sets the list of file extensions for this mime type. Each extension     * must begin with a '.' character.     */    public void setFileExtensions(String[] exts) {        extensions = exts;    }    /**     * Returns the list of file extensions for this mime type, or null if none.     */    public String[] getFileExtensions() {        return extensions;    }    /**     * Sets the default action for this mime type.     */    public void setAction(String action) {        this.action = action;    }    /**     * Returns the default action for this mime type, or null if none.     */    public String getAction() {        return action;    }    /**     * Sets the icon name for this mime type.     */    public void setIcon(String icon) {        this.icon = icon;    }    /**     * Returns the icon name for this mime type, or null if none.     */    public String getIcon() {        return icon;    }    /**     * Sets the application launcher string for this mime type.     */    public void setApplication(String app) {        application = app;    }    /**     * Returns the application launcher string for this mime type.     */    public String getApplication() {        return application;    }    /**     * Returns an array of strings that can be used with Runtime.exec()     * in order to launch the application appropriate for this mime type.     * The specified argument will be supplied to the application.     * @see MimeTable#getCommandArray(String,String)     */    public String[] getApplicationCmdArray(String arg) {        if (application != null) {            return MimeTable.getCommandArray(application, arg);        }        return null;    }    /**     * Returns a string representation of the mime type.     */    public String toString() {        StringBuffer sb = new StringBuffer();        sb.append("{type=");        sb.append(type);        if (description != null) {            sb.append(";description=");            sb.append(description);        }        if (extensions != null) {            sb.append(";extensions=");            if (extensions.length > 0) {                sb.append(extensions[0]);                for (int i = 1; i < extensions.length; i++) {                    sb.append(extensions[i]);                }            }        }        if (action != null) {            sb.append(";action=");            sb.append(action);        }        if (icon != null) {            sb.append(";icon=");            sb.append(icon);        }        if (application != null) {            sb.append(";application=");            sb.append(application);        }        sb.append('}');        return sb.toString();    }}

⌨️ 快捷键说明

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