0

...

public static void download() {
             try {
                 URL oracle = new URL("http://api.wunderground.com/api/54f05b23fd8fd4b0/geolookup/conditions/forecast/q/US/CO/Denver.json");
                 BufferedReader in = new BufferedReader(new InputStreamReader(oracle.openStream()));

                 File file = new File("C:\\Users\\User\\Desktop\\test2.json");
                 if (!file.exists()) {
                     file.createNewFile();
                 }
                 FileWriter fw = new FileWriter(file.getAbsoluteFile());
             BufferedWriter bw = new BufferedWriter(fw);

                 String inputLine;
                 while ((inputLine = in.readLine()) != null) {
                     bw.write(inputLine+"\n");
                 }
                 fw.close();
                 in.close();
                 System.out.println("Finished...");
             }
             catch(MalformedURLException e){e.printStackTrace();}
             catch(IOException e){e.printStackTrace();}
         }

Wunderground から最新の天気情報を取得するための Web クローラーを作成しています。私はこれを機能させましたが、ドキュメント全体 (最後のビットのカット) を解析しません。私は何を間違えましたか?

4

1 に答える 1