[表示 : 全て 最新50 1-99 101- 201- 301- 401- 501- 601- 701- 801- 901- 1001- 2chのread.cgiへ]
Update time : 07/05 19:48 / Filesize : 320 KB / Number-of Response : 1002
[このスレッドの書き込みを削除する]
[+板 最近立ったスレ&熱いスレ一覧 : +板 最近立ったスレ/記者別一覧] [類似スレッド一覧]


↑キャッシュ検索、類似スレ動作を修正しました、ご迷惑をお掛けしました

CLDC+MIDP+携帯電話用Javaスレッド part 3



113 名前:デフォルトの名無しさん [04/08/24 18:58]
MIDPのhttp接続について質問させてください。最初にソースです。finallの処理は省略してますy
public String setHTTPConnection( String service, String dat, int len )
{
 String url = "localhost/test/test.php&dat=";
 HttpConnection con = null;
 InputStream in = null;
 try{
  con = (HttpConnection)Connector.open(url,Connector.READ,true);
  con.setRequestMethod(HttpConnection.GET);
  in = con.openInputStream();
  int length = (int)con.getLength();
  if(length<0) {
   ByteArrayOutputStream _o = new ByteArrayOutputStream();
   byte[] buf = new byte[len];
   int t = 0;
   while((t=in.read(buf))!=-1){
    _o.write(buf,0,t);
   }
   _o.close();
   str = new String(_o.toByteArray());
  }else{
   byte[] buf = new byte[length];
   in.read(buf);
   str = new String(buf);
  }
 } catch(Exception e){}
 return str;
}







[ 続きを読む ] / [ 携帯版 ]

全部読む 前100 次100 最新50 [ このスレをブックマーク! 携帯に送る ] 2chのread.cgiへ
[+板 最近立ったスレ&熱いスレ一覧 : +板 最近立ったスレ/記者別一覧](;´∀`)<320KB

read.cgi ver5.27 [feat.BBS2 +1.6] / e.0.2 (02/09/03) / eucaly.net products.
担当:undef