杂记

来源:互联网 发布:机房环境监控系统源码 编辑:程序博客网 时间:2024/06/03 23:55

1-yahyooWeather服务

import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import org.apache.log4j.Logger;
public class YahooRetriever {
private static Logger log = Logger.getLogger(YahooRetriever.class);
public InputStream retrieve(int zipcode) throws Exception {
log.info( “Retrieving Weather Data” );
String url = “http://weather.yahooapis.com/forecastrss?p=” + zipcode;
URLConnection conn = new URL(url).openConnection();
return conn.getInputStream();
}
}

0 0
原创粉丝点击