Alfredo Castillo 6 yıl önce
ebeveyn
işleme
64d17f746c

+ 3
- 1
.idea/misc.xml Dosyayı Görüntüle

@@ -7,5 +7,7 @@
7 7
       </list>
8 8
     </option>
9 9
   </component>
10
-  <component name="ProjectRootManager" version="2" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
10
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
11
+    <output url="file://$PROJECT_DIR$/classes" />
12
+  </component>
11 13
 </project>

+ 1
- 1
.idea/modules.xml Dosyayı Görüntüle

@@ -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$/ZCW-Fido-URLFetch.iml" filepath="$PROJECT_DIR$/ZCW-Fido-URLFetch.iml" />
6 6
     </modules>
7 7
   </component>
8 8
 </project>

+ 1
- 1
.idea/vcs.xml Dosyayı Görüntüle

@@ -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>

.idea/ZCW-Fido-URLFetch.iml → ZCW-Fido-URLFetch.iml Dosyayı Görüntüle

@@ -5,8 +5,6 @@
5 5
     <output-test url="file://$MODULE_DIR$/target/test-classes" />
6 6
     <content url="file://$MODULE_DIR$">
7 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 8
       <excludeFolder url="file://$MODULE_DIR$/target" />
11 9
     </content>
12 10
     <orderEntry type="inheritedJdk" />

+ 24
- 1
src/main/java/Main.java Dosyayı Görüntüle

@@ -1,7 +1,30 @@
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) {
3
-        //ask for a url
7
+        System.out.println("enter a url");
8
+
9
+        //ask for 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
+        String content = null;
16
+        URLConnection connection = null;
17
+        try {
18
+            connection =  new URL(url).openConnection();
19
+            Scanner urlscanner = new Scanner(connection.getInputStream());
20
+            urlscanner.useDelimiter("\\Z");
21
+            content = urlscanner.next();
22
+        }catch ( Exception ex ) {
23
+            ex.printStackTrace();
24
+        }
25
+
26
+        System.out.println(content);
27
+
5 28
         // print the url
6 29
     }
7 30
 }

BIN
target/classes/Main.class Dosyayı Görüntüle