Arin Turpin 6 gadus atpakaļ
vecāks
revīzija
8c5573c774

+ 0
- 15
.idea/ZCW-Fido-URLFetch.iml Parādīt failu

@@ -1,15 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
-  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
4
-    <output url="file://$MODULE_DIR$/target/classes" />
5
-    <output-test url="file://$MODULE_DIR$/target/test-classes" />
6
-    <content url="file://$MODULE_DIR$">
7
-      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8
-      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
9
-      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
10
-      <excludeFolder url="file://$MODULE_DIR$/target" />
11
-    </content>
12
-    <orderEntry type="inheritedJdk" />
13
-    <orderEntry type="sourceFolder" forTests="false" />
14
-  </component>
15
-</module>

+ 0
- 3
.idea/compiler.xml Parādīt failu

@@ -9,8 +9,5 @@
9 9
         <module name="ZCW-Fido-URLFetch" />
10 10
       </profile>
11 11
     </annotationProcessing>
12
-    <bytecodeTargetLevel>
13
-      <module name="ZCW-Fido-URLFetch" target="1.8" />
14
-    </bytecodeTargetLevel>
15 12
   </component>
16 13
 </project>

+ 4
- 1
.idea/misc.xml Parādīt failu

@@ -1,5 +1,6 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <project version="4">
3
+  <component name="ExternalStorageConfigurationManager" enabled="true" />
3 4
   <component name="MavenProjectsManager">
4 5
     <option name="originalFiles">
5 6
       <list>
@@ -7,5 +8,7 @@
7 8
       </list>
8 9
     </option>
9 10
   </component>
10
-  <component name="ProjectRootManager" version="2" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
11
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
12
+    <output url="file://$PROJECT_DIR$/out" />
13
+  </component>
11 14
 </project>

+ 0
- 8
.idea/modules.xml Parādīt failu

@@ -1,8 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<project version="4">
3
-  <component name="ProjectModuleManager">
4
-    <modules>
5
-      <module fileurl="file://$PROJECT_DIR$/.idea/ZCW-Fido-URLFetch.iml" filepath="$PROJECT_DIR$/.idea/ZCW-Fido-URLFetch.iml" />
6
-    </modules>
7
-  </component>
8
-</project>

+ 1
- 1
.idea/vcs.xml Parādīt failu

@@ -1,6 +1,6 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <project version="4">
3 3
   <component name="VcsDirectoryMappings">
4
-    <mapping directory="" vcs="Git" />
4
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
5 5
   </component>
6 6
 </project>

+ 25
- 0
src/main/java/Main.java Parādīt failu

@@ -1,7 +1,32 @@
1
+import java.net.URL;
2
+import java.net.URLConnection;
3
+import java.util.Scanner;
4
+
1 5
 public class Main {
2 6
     public static void main(String[] args) {
7
+        System.out.println("Enter a url: ");
8
+
3 9
         //ask for a url
10
+        Scanner scanner = new Scanner(System.in);
11
+        String url = scanner.nextLine().trim();
12
+        System.out.println("Fetching " + url);
13
+
4 14
         // fetch the url
15
+
16
+        String content = null;
17
+        URLConnection connection = null;
18
+        try {
19
+            connection =  new URL(url).openConnection();
20
+            Scanner urlScanner = new Scanner(connection.getInputStream());
21
+            urlScanner.useDelimiter("\\Z");
22
+            content = urlScanner.next();
23
+        }catch (Exception ex ) {
24
+            ex.printStackTrace();
25
+        }
26
+        // Print the content
27
+        System.out.println(content);
28
+
29
+
5 30
         // print the url
6 31
     }
7 32
 }

Binārs
target/classes/Main.class Parādīt failu