//从URL中读取资源
URL url = new URL("http://www.baidu.com") ;
InputStream is = url.openStream() ;
InputStreamReader isr = new InputStreamReader(is) ;
BufferedReader br = new BufferedReader(isr) ;
String a = br.readLine() ;
while(a!=null){
System.out.println(a);
a = br.readLine() ;
}
URL url = new URL("http://www.baidu.com") ;
InputStream is = url.openStream() ;
InputStreamReader isr = new InputStreamReader(is) ;
BufferedReader br = new BufferedReader(isr) ;
String a = br.readLine() ;
while(a!=null){
System.out.println(a);
a = br.readLine() ;
}
2015-06-11
url.getProtocal() ;
url.getHost() ;
url.getPort() ;
url.getPath() ;
url.getFile() ;
ur.getRef() ;
url.getQuery() ;
url.getHost() ;
url.getPort() ;
url.getPath() ;
url.getFile() ;
ur.getRef() ;
url.getQuery() ;
2015-06-11