This article is a mirror article of machine translation, please click here to jump to the original article.

View: 19168|Reply: 7

[Java Source Code] Java Edition Web Source Code Viewer

[Copy link]
Posted on 11/30/2014 5:26:17 PM | | | |
  1. import java.io.BufferedReader;   
  2. import java.io.InputStreamReader;   
  3. import java.net.HttpURLConnection;   
  4. import java.net.URL;   
  5.   
  6. /*@src  http://eric-619.javaeye.com/blog/693741*/  
  7. public class NetBug{   
  8.     public static void main(String[] args){   
  9.         new NetBug().methodPa("http://www.itsvse.com/forum.php");   
  10.     }   
  11.       
  12.     public void methodPa(String strURL){   
  13.         String temp;   
  14.         try{   
  15.             URL url = new URL(strURL);   
  16.             HttpURLConnection conn = (HttpURLConnection)url.openConnection();   
  17.             InputStreamReader isr = new InputStreamReader(conn.getInputStream(),"gb2312");   
  18.             BufferedReader br = new BufferedReader(isr);   
  19.             while((temp = br.readLine()) != null){   
  20.                 System.out.println(temp);   
  21.             }      
  22.             br.close();   
  23.             isr.close();   
  24.         }catch(Exception e){   
  25.             e.printStackTrace();   
  26.         }   
  27.     }   
  28. }
Copy code

4.png (115.1 KB, Number of downloads: 686)





Previous:Java version of web crawler
Next:Teach you to quickly understand the file function of Discuz!, and you don't have to ask for help to modify files from now on
Posted on 11/30/2014 5:35:07 PM |
Don't lose Java technology!
Posted on 11/30/2014 5:39:04 PM |
I also want to be a technical cow
Posted on 11/30/2014 5:43:09 PM |
The landlord's code is written very rigorously br.close();     isr.close(); Know how to free up resources
 Landlord| Posted on 11/30/2014 6:30:49 PM |
admin posted on 2014-11-30 17:39
I also want to be a technical cow

Is Wusoft Forum GBK?
 Landlord| Posted on 11/30/2014 6:37:37 PM |

Looking at the source code, it is indeed true
Posted on 11/30/2014 8:27:58 PM |
Delver_Si Posted on 2014-11-30 18:37
Looking at the source code, it is indeed true

What's wrong with GBK?
 Landlord| Posted on 11/30/2014 8:34:11 PM |
admin posted on 2014-11-30 20:27
What's wrong with GBK?

The English version of the system access is garbled
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com