★★Java質問・相談スレッド144★★
■ このスレッドは過去ログ倉庫に格納されています
0148141
2011/04/09(土) 15:53:11.88HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.connect();
if(conn.getResponseCode()==200){
// パースを実行してDocumentオブジェクトを取得
Document doc = dbfactory.newDocumentBuilder().parse(conn.getInputStream());
// ルート要素を取得
Element root = doc.getDocumentElement();
// item要素のリストを取得
NodeList itemList = root.getElementsByTagName("item");
・・・
ストリームのクローズというと、conn.getInputStream()に対してということですか?
conn.connect()に対してということだったら、>>141の通り、if文抜けたあとにdisconnect()しています。
■ このスレッドは過去ログ倉庫に格納されています