Added version check

This commit is contained in:
Robin Kupper
2011-06-11 16:14:13 +02:00
parent ad7910ab7e
commit 9aa4657e5f
4 changed files with 31 additions and 1 deletions
+12
View File
@@ -1,11 +1,13 @@
package de.diddiz.util;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.URL;
import java.text.ParseException;
@@ -47,6 +49,16 @@ public class Utils
throw new FileNotFoundException(file.getAbsolutePath() + file.getName());
}
public static String readURL(URL url) throws IOException {
final StringBuilder content = new StringBuilder();
final BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
content.append(inputLine);
in.close();
return content.toString();
}
public static boolean isInt(String str) {
try {
Integer.parseInt(str);