-
Notifications
You must be signed in to change notification settings - Fork 0
/
URLinfo
38 lines (29 loc) · 1.14 KB
/
URLinfo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package test;
import java.net.URL;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.Proxy;
import java.net.URISyntaxException;
public class Urlinfo {
public static void main(String[] args) throws MalformedURLException,IOException, URISyntaxException {
// TODO Auto-generated method stub
//
//Proxy proxy;
URL url =
new URL("https://github.com/Akki-T/Java_Practise");
System.out.println("host :"+url.getHost());
System.out.println("Port :"+url.getPort());
System.out.println("Path :"+url.getPath());
System.out.println("Default port :"+url.getDefaultPort());
System.out.println("Query : "+url.getQuery());
// System.out.println("open connection with proxy" +url.openConnection(proxy));
//System.out.println(url.openStream());
System.out.println("Protocol: "+url.getProtocol());
System.out.println("Authority : "+url.getAuthority());
System.out.println("URL provided :"+url.toString());
System.out.println("User Info :"+url.getUserInfo());
System.out.println("Open connection :"+url.openConnection());
System.out.println("URI of URL :"+url.toURI());
}
}