List of usage examples for java.net URL URL
public URL(String spec) throws MalformedURLException
From source file:MainClass.java
public static void main(String[] args) throws MalformedURLException { URL u = new URL("http://www.java2s.com"); System.out.printf("HASHCODE: %H\n", u); }
From source file:MainClass.java
public static void main(String[] args) throws MalformedURLException { URL u = new URL("http://www.java2s.com"); System.out.printf("string: %s\n", u); }
From source file:MainClass.java
public static void main(String[] args) throws MalformedURLException { URL u = new URL("http://www.java2s.com"); System.out.printf("STRING: %S\n", u); }
From source file:MainClass.java
public static void main(String[] args) throws MalformedURLException { URL u = new URL("http://www.java2s.com"); System.out.printf("boolean: %b\n", u); }
From source file:Main.java
public static void main(String[] argv) throws Exception { // Create a URL that refers to a jar file on the net URL url = new URL("jar:http://hostname/my.jar!/"); }
From source file:Main.java
public static void main(String args[]) throws Exception { URL url = new URL("http://www.google.com"); HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); System.out.println("Response code is " + httpCon.getResponseCode()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { int size;// w w w . j ava 2 s . c o m URL url = new URL("http://www.server.com"); URLConnection conn = url.openConnection(); size = conn.getContentLength(); if (size < 0) System.out.println("Could not determine file size."); else System.out.println(size); conn.getInputStream().close(); }
From source file:Main.java
public static void main(String args[]) throws Exception { URL url = new URL("http://www.google.com"); HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); System.out.println("Response Message is " + httpCon.getResponseMessage()); }
From source file:Main.java
public static void main(String args[]) throws Exception { URL url = new URL("http://www.google.com"); HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); System.out.println("Request method is " + httpCon.getRequestMethod()); }
From source file:Main.java
public static void main(String args[]) throws Exception { URL url = new URL("http://www.google.com"); HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); System.out.println("Content-Type: " + httpCon.getContentType()); }