import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
class a1{
public static void main(String[] args) {
String add = "http://www.weather.com.cn/data/sk/101010100.html";
try {
URL url = new URL(add);
HttpURLConnection httpUrlconn = (HttpURLConnection)url.openConnection();
httpUrlconn.setReadTimeout(3000);
httpUrlconn.connect();
if(httpUrlconn.getResponseCode()==200){
InputStream insp = httpUrlconn.getInputStream();
ByteOutputStream ops = new ByteOutputStream();
int intRet = -1;
while((intRet=insp.read())!=-1){
ops.write(intRet);
}
byte[] bytes = ops.getBytes();
String ret = new String(bytes,"utf-8");
System.out.println(ret);
httpUrlconn.disconnect();
}
}catch (Exception e){
System.out.print(e);
}
}
}