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

📄 updateuserdatathread.java

📁 j2me实例代码
💻 JAVA
字号:
package serverlet;

import javax.microedition.io.*;
import java.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.util.*;

public class UpdateUserDataThread extends Thread {
	String url;
	public UpdateUserDataThread(String url,String id,String pw,String ds){
		String enc=System.getProperty("microedition.encoding");
		System.out.println("系统使用编码:"+enc);
		this.url=url+"?id="+id+"&pw="+pw+"&ds="+ds;
		System.out.println("url:"+this.url);
	}
	public void run(){
		boolean error=false;
		HttpConnection c=null;
		InputStream is=null;
		OutputStream os=null;
		DataInputStream dos=null;
		String line="";
		
		try{
			c=(HttpConnection)Connector.open(url);
			System.out.println("back code::"+c.getResponseCode());
			is=c.openInputStream();
			dos=new DataInputStream(is);
			line=dos.readUTF();
		}catch(EOFException e){
			System.out.println(".........:"+line);
		}catch(Exception e){
			error=true;
			Alert al=new Alert("更新时期发生错误",e.toString(),null,AlertType.ALARM);
			al.setTimeout(Alert.FOREVER);
			Navigator.display.setCurrent(al);
		}finally{
			try{
				if(is!=null)
					is.close();
				if(os!=null)
					os.close();
				if(c!=null)
					c.close();
			}catch(Exception e){}
		}
		if(!error){
			Alert al=new Alert("update result",line,null,AlertType.CONFIRMATION);
			al.setTimeout(Alert.FOREVER);
			Navigator.display.setCurrent(al);
		}
		
	}
}

⌨️ 快捷键说明

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