#32 Fido-Url

Otwarty
NavyaSanal chce scalić 2 commity/ów z NavyaSanal/ZCW-Fido-URLFetch:simplesoln do master
2 zmienionych plików z 67 dodań i 46 usunięć
  1. 19
    46
      .gitignore
  2. 48
    0
      src/rocks/zipcode/fido/FidoFetch.java

+ 19
- 46
.gitignore Wyświetl plik

1
-# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
2
-# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
1
+# ---> Java
2
+# Compiled class file
3
+*.class
3
 
4
 
4
-# User-specific stuff
5
-.idea/**/workspace.xml
6
-.idea/**/tasks.xml
7
-.idea/**/dictionaries
8
-.idea/**/shelf
5
+# Log file
6
+*.log
9
 
7
 
10
-# Sensitive or high-churn files
11
-.idea/**/dataSources/
12
-.idea/**/dataSources.ids
13
-.idea/**/dataSources.local.xml
14
-.idea/**/sqlDataSources.xml
15
-.idea/**/dynamic.xml
16
-.idea/**/uiDesigner.xml
17
-.idea/**/dbnavigator.xml
8
+# BlueJ files
9
+*.ctxt
18
 
10
 
19
-# Gradle
20
-.idea/**/gradle.xml
21
-.idea/**/libraries
11
+# Mobile Tools for Java (J2ME)
12
+.mtj.tmp/
22
 
13
 
23
-# CMake
24
-cmake-build-debug/
25
-cmake-build-release/
14
+# Package Files #
15
+*.jar
16
+*.war
17
+*.ear
18
+*.zip
19
+*.tar.gz
20
+*.rar
26
 
21
 
27
-# Mongo Explorer plugin
28
-.idea/**/mongoSettings.xml
22
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23
+hs_err_pid*
29
 
24
 
30
-# File-based project format
31
-*.iws
32
-
33
-# IntelliJ
34
-out/
35
-
36
-# mpeltonen/sbt-idea plugin
37
-.idea_modules/
38
-
39
-# JIRA plugin
40
-atlassian-ide-plugin.xml
41
-
42
-# Cursive Clojure plugin
43
-.idea/replstate.xml
44
-
45
-# Crashlytics plugin (for Android Studio and IntelliJ)
46
-com_crashlytics_export_strings.xml
47
-crashlytics.properties
48
-crashlytics-build.properties
49
-fabric.properties
50
-
51
-# Editor-based Rest Client
52
-.idea/httpRequests
25
+.DS_Store

+ 48
- 0
src/rocks/zipcode/fido/FidoFetch.java Wyświetl plik

1
+package rocks.zipcode.fido;
2
+
3
+import java.io.BufferedReader;
4
+import java.io.InputStreamReader;
5
+import java.net.URL;
6
+
7
+public class FidoFetch {
8
+    private URL oracle;
9
+
10
+    public FidoFetch(URL oracle) throws Exception {
11
+        this.oracle = oracle;
12
+        this.fetchToOutput(this.oracle);
13
+    }
14
+
15
+    public FidoFetch() {
16
+    }
17
+
18
+    public void fetchToOutput(URL url) throws Exception {
19
+
20
+        // open a stream for the URL
21
+        BufferedReader in = new BufferedReader(
22
+                new InputStreamReader(url.openStream()));
23
+
24
+        String inputLine;
25
+        // while there is stuff in the stream, read a line at a time and print it out.
26
+        while ((inputLine = in.readLine()) != null)
27
+            System.out.println(inputLine);
28
+        in.close();
29
+
30
+    }
31
+
32
+    public static void main(String[] args) {
33
+        String urlString = "";
34
+
35
+        // get the url from the commandline
36
+        if (args.length > 0) {
37
+            urlString = args[0];
38
+        }
39
+
40
+        FidoFetch f = new FidoFetch();
41
+        try {
42
+            f.fetchToOutput(new URL(urlString));
43
+        } catch (Exception e) {
44
+            e.printStackTrace();
45
+        }
46
+    }
47
+
48
+}