我正在开发J2ME
您能不能帮我找出这段代码的错误:
HttpConnection c = null;
try {
c = (HttpConnection)Connector.open("http://www.mysite.com",Connector.READ_WRITE, true);
c.setRequestMethod(HttpConnection.GET); //default
is = c.openInputStream(); // transition to connected!
int ch = 0;
for(int ccnt=0; ccnt < 150; ccnt++) { // get the title.
ch = is.read();
if (ch == -1){
break;
}
sb.append((char)ch);
}
}
catch (IOException x){
x.printStackTrace();
}
finally{
try {
is.close();
c.close();
} catch (IOException x){
x.printStackTrace();
}
}
System.out.println(sb.toString());
我正在尝试通过我的应用程序打开网站,谢谢之前:)