Find knowledge base article(s) by searching for keywords in the title e.g. type linux in the search box below
Find knowledge base article(s) by browsing the subject categories of articles
Technology quick references, cheatsheets, user manuals etc.
Shop Online through ShopifyLite
Tutorials on various IT applications.
Search Title    (UL:0 |SS:f)

Software >> Development >> Languages >> Java >> examples >> URLReader.java

/* */ import java.net.*; import java.io.*; /* * This example illustrates using a URL to access resources * on a secure site. * * If you are running inside a firewall, please also set the following * Java system properties to the appropriate value: * * http.proxyHost = <proxy server hostname> * http.proxyPort = <proxy server port> * * https.proxyHost = <secure proxy server hostname> * https.proxyPort = <secure proxy server port> */ public class URLReader { public static void main(String[] args) throws Exception { String inputLine; String urlstring; urlstring=""; if (args.length < 1) { System.out.println( "USAGE: java URLReader " + "URL"); System.exit(-1); } try { urlstring = args[0]; } catch (IllegalArgumentException e) { System.out.println("USAGE: java URLReader " + "URL"); System.exit(-1); } URL myurl = new URL(urlstring); BufferedReader in = new BufferedReader( new InputStreamReader( myurl.openStream())); while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); } }
[ © 2008-2021 myfaqbase.com - A property of WPDC Consulting ]