📄 midletinfo.java
字号:
/* * @(#)MIDletInfo.java 1.3 01/08/08 * Copyright (c) 1999-2001 Sun Microsystems, Inc. All Rights Reserved. * * This software is the confidential and proprietary information of Sun * Microsystems, Inc. ("Confidential Information"). You shall not * disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into * with Sun. * * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING * THIS SOFTWARE OR ITS DERIVATIVES. */package com.sun.midp.midlet;/** * Simple attribute storage for MIDlets in the descriptor/manifest. */public class MIDletInfo { /** The name of the MIDlet. */ public String name; /** The icon of the MIDlet. */ public String icon; /** The main class for the MIDlet. */ public String classname; /** * Parses out the name, icon and classname. * @param attr contains the name, icon and classname line to be * parsed */ public MIDletInfo(String attr) { String[] args; int start; int offset = 0; if (attr == null) { return; } args = new String[3]; for (int i = 0; i < 3 && offset < attr.length(); i++) { if (attr.charAt(offset) == ',') { offset++; } start = offset; offset = skipToToken(attr, start); if ((offset - start) > 0) { // don't forget to trim the leading and trailing spaces args[i] = attr.substring(start, offset).trim(); } } this.name = args[0]; this.icon = args[1]; this.classname = args[2]; } /** * Container class to hold information about the current MIDlet. * @param name the name of the MIDlet from descriptor file or * manifest * @param icon the icon to display when the user selects the MIDlet * from a list * @param classname the main class for this MIDlet */ public MIDletInfo(String name, String icon, String classname) { this.name = name; this.icon = icon; this.classname = classname; } /** * Skip over characters other ',', stop at end of string * @param s the string to parse * @param offset initial offset in the string to begine the token search. * @return the position of the next token */ private int skipToToken(String s, int offset) { int pos; pos = s.indexOf(',', offset); if (pos >= 0) { return pos; } return s.length(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -