public String read(String urlString){        
        try {
            StringBuffer html = new StringBuffer();  
            URL url = new URL(urlString);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            InputStreamReader inputReader = new InputStreamReader(conn.getInputStream());
            BufferedReader bufferedReader = new BufferedReader(inputReader);
            String temp;
               while ((temp = bufferedReader.readLine()) != null) {
                if(!temp.trim().equals("")){
                 html.append(temp).append("\n");
                }
               }
               bufferedReader.close();
                inputReader.close();
               return html.toString();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

 

posted on 2013-09-06 08:41  new PersonBean()  阅读(318)  评论(0编辑  收藏  举报