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

📄 encoding.java

📁 在手机应用程序开发时
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */import com.sun.midp.io.HttpUrl;import javax.microedition.io.HttpConnection;import javax.microedition.midlet.*;import javax.microedition.lcdui.*;/** * @author tpwhw */public class Encoding extends MIDlet implements CommandListener {    private Command cmd_Exit=new Command("退出", Command.EXIT, 1);    private Command cmd_Conn=new Command("Get",Command.SCREEN,1);    private Command cmd_Post=new Command("Post",Command.SCREEN,1);    private boolean init=true;    private Display disp=Display.getDisplay(this);    private Form fm=new Form(null);    public void startApp() {        if (init){            init=false;            disp.setCurrent(fm);            fm.setCommandListener(this);                        byte[] b={};            String[] s={"ucs-2","utf-8","utf8","utf_8","gb2312","gbk","unicode"};            for (int i = 0; i < s.length; i++) {                try {                   b="中国人民共和国".getBytes(s[i]);                   String str= new String(b, s[i]);                   fm.append(s[i]+":"+Integer.toString(b.length)+"  "+str);                } catch (Exception e) {                }                try {                   b="中国人民共和国".getBytes(s[i].toUpperCase());                   String str= new String(b, s[i].toUpperCase());                   fm.append(s[i].toUpperCase()+":"+Integer.toString(b.length)+"  "+str);                } catch (Exception e) {                }                            }            fm.addCommand(cmd_Conn);            fm.addCommand(cmd_Exit);            fm.addCommand(cmd_Post);        }    }    public void pauseApp() {    }    public void destroyApp(boolean unconditional) {    }    public void commandAction(Command c, Displayable d) {        if (c==cmd_Exit){            notifyDestroyed();        }else if(c==cmd_Conn){        new HtppConn(this);        }else if(c==cmd_Post){            new TESTPost(this);        }    }}

⌨️ 快捷键说明

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