📄 dirinput.java
字号:
//程序名DirInput.java,项目DirInput
//测试从Connector类直接获得InputStream
import javax.microedition.midlet.*;
import javax.microedition.io.*;
import java.io.*;
public class DirInput extends MIDlet {
InputStream is = null;
public void startApp() {
try {
String url ="http://localhost:8080/j2me/html/TestConnection.html";
is = Connector.openInputStream(url);
int ch;
while ((ch = is.read()) != -1) {
System.out.print((char)ch);
}
if (is != null)
is.close();
} catch( ConnectionNotFoundException e ){
System.out.println( "Http could not be opened" );
} catch (IOException e) {
System.out.println("other error.");
}
notifyDestroyed();//测试完毕后关闭应用程序
}
public void pauseApp() {}
public void destroyApp( boolean unconditional ) {}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -