📄 testhttp.java
字号:
//程序名TestHTTP.java;
import java.io.*;
import javax.microedition.io.*;
public class TestHTTP {
public static void main( String[] args ){
try {
String uri ="http://127.0.0.1/test.html";
ContentConnection conn = (ContentConnection)Connector.open( uri );
InputStream in = conn.openInputStream();
int ch;
System.out.println( "Content type is " + conn.getType() );
while( ( ch = in.read() ) != -1 ){
System.out.print( (char) ch );
}
in.close();
conn.close();
} catch( ConnectionNotFoundException e ){
System.out.println("URI could not be opened" );
} catch( IOException e ){
System.out.println( e.toString() );
}
System.exit( 0 );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -