--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/slides/URLReader.java Thu Nov 10 04:02:45 2016 +0000
@@ -0,0 +1,32 @@
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Scanner;
+
+public class URLReader {
+
+ public static String readURL(String sUrl) {
+ StringBuilder buf = new StringBuilder();
+ Scanner in = null;
+
+ try {
+ URL url = new URL(sUrl);
+ in = new Scanner(url.openStream());
+
+ while (in.hasNextLine()) {
+ buf.append(in.nextLine() + "\n");
+ }
+ return buf.toString();
+
+ } catch (MalformedURLException e) {
+ System.err.println(e);
+ } catch (IOException e) {
+ System.err.println(e);
+ } finally {
+ if (in != null) {
+ in.close();
+ }
+ }
+ return null;
+ }
+}
\ No newline at end of file