This commit is contained in:
Clisprail
2013-06-20 20:19:24 +02:00
parent acb1f8e02d
commit d08640127a
133 changed files with 40524 additions and 67 deletions
@@ -1,6 +1,8 @@
package org.parabot.environment.api.utils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
@@ -69,15 +71,28 @@ public class WebUtil {
*/
public static BufferedReader getReader(final URL url) {
try {
final URLConnection con = getConnection(url);
return new BufferedReader(new InputStreamReader(
con.getInputStream()));
return new BufferedReader(new InputStreamReader(getInputStream(url)));
} catch (Throwable t) {
t.printStackTrace();
}
return null;
}
/**
* Gets inputstream from url
* @param url
* @return inputstream from url
*/
public static InputStream getInputStream(final URL url) {
final URLConnection con = getConnection(url);
try {
return con.getInputStream();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
/**
* Opens a connection
* @param url