Fix latest build break

This commit is contained in:
romanman 2014-07-07 15:09:29 +01:00
parent cf49683489
commit 6545049a16
1 changed files with 29 additions and 0 deletions

View File

@ -1,6 +1,10 @@
package org.ethereum.util;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.net.HttpURLConnection;
import java.net.URL;
import java.security.SecureRandom;
import java.text.DateFormat;
@ -95,4 +99,29 @@ public class Utils {
if (retVal.length() == 1) retVal = "0" + retVal;
return retVal;
}
public static String getHTML(String urlToRead) {
URL url;
HttpURLConnection conn;
BufferedReader rd;
String line;
String result = "";
try {
url = new URL(urlToRead);
conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
while ((line = rd.readLine()) != null) {
result += line;
}
rd.close();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
}