intermediate/URLExplore

From ggc

Jump to: navigation, search

01 package intermediate;
02 //start auto-imports
03 import java.io.*;
04 import java.util.*;
05 //end auto-imports
06 
07 import java.net.*;
08 
09 /**
10  * All about my application.
11  @author Jam Jenkins
12  */
13 public class URLExplore
14 {
15   public static void main(String[] args)
16   {
17     try
18     {
19       String address="http://ggc.javawide.org/index.php/Main_Page";
20       URL url=new URL(address);
21       InputStream in=url.openStream();
22       String source=
23           "Happy days\n"+
24           "are here to stay.";
25       Scanner scanner=new Scanner(in);
26       scanner.useDelimiter("\\Q<ul>\\E|\\Q</ul>\\E");
27       System.out.println("Source is \n"+source);
28       while(scanner.hasNext())
29       {
30         scanner.next();
31         String contents=scanner.next();
32         System.out.println(contents);
33 
34       }
35     }
36     catch(IOException scoobyDo)
37     { }
38   }
39 }


Download/View intermediate/URLExplore.java





Views
Personal tools
Add to 
del.icio.usAdd to 
diggAdd to 
FacebookAdd to 
favoritesAdd to 
GoogleAdd to 
MySpaceAdd to 
PrintAdd to 
SlashdotAdd to 
StumbleUponAdd to 
Twitter