没问题,可以把html当作一个文件打开,使用流传输,我做过这东西。不过我的代码已经不再了

解决方案 »

  1.   

    不清楚楼主要干什么?
    是要把url指向的网页的内容保存下来?
    如果事的话。用HttpURLConnection不就可以了吗?
      

  2.   

    import java.io.*;
    import java.net.*;
    import java.util.Date;class URLDemo
    {
      public static void main(String args[]) throws Exception
      {
        System.out.println("starting....");
        int c;
        URL url = new URL("http://www.sina.com.cn");
        URLConnection urlcon = url.openConnection();
        System.out.println("the date is : " + new Date(urlcon.getDate()));
        System.out.println("content_type:" + urlcon.getContentType());
        InputStream in = rulcon.getInputStream();
        while(((c=in.read())!=-1))
        {
           System.out.println((char)c);
         }
         in.close();
      }
    }
      

  3.   

    类似于保存成一个mht的web档案文件
      

  4.   

    URL url=new URL("http://192.168.0.109:8080/yinxing/content/12");
    HttpURLConnection open=(HttpURLConnection)url.openConnection();
    open.connect();
    BufferedReader buf=new BufferedReader(new InputStreamReader(open.getInputStream()));
    String temp=null;
    while((temp=buf.readLine())!=null)System.out.println(temp);
    buf.close();
      

  5.   

    zhaoxichao(小西) 
    HTM中的图片可以取得。但有前提就是你的把<IMG SRC..后面的图片的相对URL取出来(通过正则表达式),然后在通过HttpURLConnection来去图片。
      

  6.   

    import java.net.*;
    import java.io.*;
    public class URLConnectionReader
    {
    public static void main(String[] args) throws Exception
    {
    URL yahoo = new URL("http://www.chinaren.com/");
    URLConnection yc = yahoo.openConnection();
    BufferedReader in = new BufferedReader(
    new InputStreamReader(
    yc.getInputStream()));
    String inputLine;
    while ((inputLine = in.readLine()) != null)
    System.out.println(inputLine);
    in.close();
    }
    }
    这样可以得到你想要的HTML代码,然后把这些代码写到一个HTML文件不就完了吗