private String getHttp(String url)
{
System.out.println("getHttp:"+url);
String re = "";
try{
HttpConnection httpConn = (HttpConnection)Connector.open(url);
System.out.println("getCode:"+httpConn.getResponseCode());
InputStream isStrm = httpConn.openInputStream();
DataInputStream in = new DataInputStream(isStrm);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int ch;
while ((ch = in.read()) != -1) {
baos.write(ch);
}
byte[] bstr = baos.toByteArray();
re = new String(bstr);
} catch (Exception e){
System.out.println(e.toString());
e.printStackTrace();
}
return re;
}
void th()
{
try{
Thread iniTh = new Thread(sps);
iniTh.start();
iniTh.join();
} catch (Exception e){
e.printStackTrace();
}
}
sps对象的start会调用 getHttp
但是没反应啊
System.out.println("getCode:"+httpConn.getResponseCode());
这句没有执行