|
@@ -0,0 +1,52 @@
|
|
1
|
+
|
|
2
|
+import java.io.BufferedReader;
|
|
3
|
+import java.io.IOException;
|
|
4
|
+import java.io.InputStream;
|
|
5
|
+import java.io.InputStreamReader;
|
|
6
|
+import java.net.MalformedURLException;
|
|
7
|
+import java.net.URL;
|
|
8
|
+import java.net.URLConnection;
|
|
9
|
+import java.util.Scanner;
|
|
10
|
+import java.util.logging.Level;
|
|
11
|
+import java.util.logging.Logger;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+public class Fido {
|
|
15
|
+
|
|
16
|
+ public static void main(String args[]) {
|
|
17
|
+ Scanner s = new Scanner(System.in);
|
|
18
|
+ Fido fido = new Fido(s.next());
|
|
19
|
+ fido.printHTML();
|
|
20
|
+ }
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+ private URLConnection connection;
|
|
24
|
+ private final Logger logger = Logger.getGlobal();
|
|
25
|
+
|
|
26
|
+ public Fido(String url) {
|
|
27
|
+ try {
|
|
28
|
+ connection = new URL(url).openConnection();
|
|
29
|
+ }
|
|
30
|
+ catch (IOException e) {
|
|
31
|
+ logger.log(Level.SEVERE, "Invalid URL");
|
|
32
|
+ }
|
|
33
|
+ }
|
|
34
|
+
|
|
35
|
+ public void printHTML() {
|
|
36
|
+ try {
|
|
37
|
+ BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
|
38
|
+ String inputline = bufferedReader.readLine();
|
|
39
|
+ while (inputline != null) {
|
|
40
|
+ System.out.println(inputline);
|
|
41
|
+ inputline = bufferedReader.readLine();
|
|
42
|
+ }
|
|
43
|
+ }
|
|
44
|
+ catch (IOException e) {
|
|
45
|
+ logger.log(Level.SEVERE, "404: Not Found");
|
|
46
|
+ }
|
|
47
|
+
|
|
48
|
+ }
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+}
|