`
wataxi
  • 浏览: 202322 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

Java解析URL

    博客分类:
  • java
阅读更多

import java.net.URL;

public class Test ...{
    public static void main(String[] args)

     throws Exception ...{

         URL aURL = new URL("http://www.douban.com/group/echofans");

         System.out.println("protocol = " + aURL.getProtocol());

         System.out.println("authority = " + aURL.getAuthority());
         System.out.println("host = " + aURL.getHost());

         System.out.println("port = " + aURL.getPort());

         System.out.println("path = " + aURL.getPath());

         System.out.println("query = " + aURL.getQuery());

         System.out.println("filename = " + aURL.getFile());

         System.out.println("ref = " + aURL.getRef());

     }

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics