mirror of
https://github.com/github/codeql.git
synced 2025-12-24 12:46:34 +01:00
59 lines
2.1 KiB
Java
59 lines
2.1 KiB
Java
import java.io.IOException;
|
||
import java.io.InputStream;
|
||
import java.net.Proxy;
|
||
import java.net.SocketAddress;
|
||
import java.net.URI;
|
||
import java.net.URL;
|
||
import java.net.URLConnection;
|
||
import java.net.URLStreamHandler;
|
||
import java.net.Proxy.Type;
|
||
|
||
public class Uri {
|
||
public static void main(String[] args) throws Exception {
|
||
// URI(String str)
|
||
URI uri = new URI("uri1");
|
||
|
||
// URI(String scheme, String ssp, String fragment)
|
||
URI ur2 = new URI("http", "ssp", "fragement");
|
||
|
||
// URI(String scheme, String userInfo, String host, int port, String path,
|
||
// String query, String fragment)
|
||
URI uri3 = new URI("http", "userinfo", "host", 1, "path", "query", "fragment");
|
||
// URI(String scheme, String host, String path, String fragment)
|
||
URI uri4 = new URI("http", "host", "path", "fragment");
|
||
// URI(String scheme, String authority, String path, String query, String
|
||
// fragment)
|
||
URI uri5 = new URI("http", "authority", "path", "query", "fragment");
|
||
|
||
// URI.create(String str)
|
||
URI uri6 = URI.create("http://foo.com/");
|
||
|
||
// URL(String spec)
|
||
URL url1 = new URL("spec");
|
||
// URL(String protocol, String host, int port, String file)
|
||
URL url2 = new URL("http", "host", 1, "file");
|
||
// URL(String protocol, String host, String file)
|
||
URL url3 = new URL("http", "host", "file");
|
||
// URL(URL context, String spec)
|
||
URL url4 = new URL(url3, "http");
|
||
// URL(String protocol, String host, int port, String file, URLStreamHandler
|
||
// handler)
|
||
URL url5 = new URL("http", "host", 1, "file", new Helper());
|
||
|
||
// URL(URL context, String spec, URLStreamHandler handler)
|
||
URL url6 = new URL(url3, "spec", new Helper());
|
||
|
||
URLConnection c1 = url1.openConnection();
|
||
SocketAddress sa = new SocketAddress() {
|
||
};
|
||
URLConnection c2 = url1.openConnection(new Proxy(Type.HTTP, sa));
|
||
InputStream c3 = url1.openStream();
|
||
}
|
||
}
|
||
|
||
class Helper extends URLStreamHandler {
|
||
@Override
|
||
protected URLConnection openConnection(URL arg0) throws IOException {
|
||
return null;
|
||
}
|
||
} |