From 6545049a160970f0c7cd5b1d8c560e8245e672cb Mon Sep 17 00:00:00 2001 From: romanman Date: Mon, 7 Jul 2014 15:09:29 +0100 Subject: [PATCH] Fix latest build break --- .../main/java/org/ethereum/util/Utils.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/ethereumj-core/src/main/java/org/ethereum/util/Utils.java b/ethereumj-core/src/main/java/org/ethereum/util/Utils.java index 12f1c334..44fa083c 100644 --- a/ethereumj-core/src/main/java/org/ethereum/util/Utils.java +++ b/ethereumj-core/src/main/java/org/ethereum/util/Utils.java @@ -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; + } + }