1. 首页
  2. 移动开发
  3. Android
  4. URL构造方法-java网络编程

URL构造方法-java网络编程

上传者: 2024-07-08 04:28:09上传 PPT文件 1MB 热度 8次

URL构造方法

public URL (String spec)

通过一个表示URL地址的字符串可以构造一个URL对象。

URL urlBase=new URL(\"http://www. 263.net/\");

public URL(URL context, String spec)

通过基URL和相对URL构造一个URL对象。

URL net263=new URL (\"http://www.263.net/\");

URL index263=new URL(net263, \"index.html\");

public URL(String protocol, String host, String file);

URL url=new URL(\"http\", \"www.gamelan.com\", \"/pages/Gamelan.net. html\");

public URL(String protocol, String host, int port, String file);

URL gamelan=new URL(\"http\", \"www.gamelan.com\", 80, \"Pages/Gamelan.network.html\");

下载地址
用户评论