rjsmall90 6 years ago
parent
commit
56d5f7ca1a
7 changed files with 42 additions and 45 deletions
  1. 0
    15
      .idea/ZCW-Fido-URLFetch.iml
  2. 0
    16
      .idea/compiler.xml
  3. 5
    7
      .idea/misc.xml
  4. 1
    1
      .idea/modules.xml
  5. 0
    6
      .idea/vcs.xml
  6. 25
    0
      src/main/java/Main.java
  7. 11
    0
      src/main/main.iml

+ 0
- 15
.idea/ZCW-Fido-URLFetch.iml View File

@@ -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
- 16
.idea/compiler.xml View File

@@ -1,16 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<project version="4">
3
-  <component name="CompilerConfiguration">
4
-    <annotationProcessing>
5
-      <profile name="Maven default annotation processors profile" enabled="true">
6
-        <sourceOutputDir name="target/generated-sources/annotations" />
7
-        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
8
-        <outputRelativeToContentRoot value="true" />
9
-        <module name="ZCW-Fido-URLFetch" />
10
-      </profile>
11
-    </annotationProcessing>
12
-    <bytecodeTargetLevel>
13
-      <module name="ZCW-Fido-URLFetch" target="1.8" />
14
-    </bytecodeTargetLevel>
15
-  </component>
16
-</project>

+ 5
- 7
.idea/misc.xml View File

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

+ 1
- 1
.idea/modules.xml View File

@@ -2,7 +2,7 @@
2 2
 <project version="4">
3 3
   <component name="ProjectModuleManager">
4 4
     <modules>
5
-      <module fileurl="file://$PROJECT_DIR$/.idea/ZCW-Fido-URLFetch.iml" filepath="$PROJECT_DIR$/.idea/ZCW-Fido-URLFetch.iml" />
5
+      <module fileurl="file://$PROJECT_DIR$/src/main/main.iml" filepath="$PROJECT_DIR$/src/main/main.iml" />
6 6
     </modules>
7 7
   </component>
8 8
 </project>

+ 0
- 6
.idea/vcs.xml View File

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

+ 25
- 0
src/main/java/Main.java View File

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

+ 11
- 0
src/main/main.iml View File

@@ -0,0 +1,11 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<module type="JAVA_MODULE" version="4">
3
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
4
+    <exclude-output />
5
+    <content url="file://$MODULE_DIR$">
6
+      <sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
7
+    </content>
8
+    <orderEntry type="inheritedJdk" />
9
+    <orderEntry type="sourceFolder" forTests="false" />
10
+  </component>
11
+</module>