标签:path line rac 实例 http res str getpath pat
import org.junit.Test; public class TestURL { @Test public void readUrl() throws Exception{ URL url = new URL("http://localhost:8088/gress/data/reportData_201401.xml?a=b"); System.out.println(url.getProtocol()); System.out.println(url.getHost()); System.out.println(url.getPort()); System.out.println(url.getPath()); System.out.println(url.getFile()); System.out.println(url.getRef()); System.out.println(url.getQuery()); URLConnection urlConn = url.openConnection(); BufferedReader buffReader = new BufferedReader(new InputStreamReader(urlConn.getInputStream())); String str = null; while((str = buffReader.readLine()) != null ){ System.out.println(str); } buffReader.close(); } }
标签:path line rac 实例 http res str getpath pat
原文地址:http://www.cnblogs.com/ljbguanli/p/6944280.html