Monday, 30 December 2013

URL vs System.setProperty ?

-----------------------------------------------------------------------------------------------------------
URL vs System.setProperty?
---------------------------------------------------------------------------------------------------------
URL website = new URL("http", proxy, Integer.parseInt(proxyPort), websiteUrl)
BufferedReader in = new BufferedReader(new InputStreamReader(website.openStream()));
long start = System.currentTimeMillis();
while ((in.readLine()) != null){}
long elapsedTimeMillis = System.currentTimeMillis()-start;

-------------------------------------------------------------------------------------------------------------

URL website = new URL(websiteUrl);
System.setProperty("http.proxyHost", proxy);
System.setProperty("http.proxyPort", proxyPort);
BufferedReader in = new BufferedReader(new InputStreamReader(website.openStream()));
long start = System.currentTimeMillis();
while ((in.readLine()) != null){}
long elapsedTimeMillis = System.currentTimeMillis()-start;
-----------------------------------------------------------------------------------------------------------

No comments:

Post a Comment