package test;
import java.io.*;
import java.net.*;
import java.nio.charset.Charset;
import java.util.Properties;public class RssXml
{
    public static void main(String[] args)
    {
String s1 = "http://rss.sina.com.cn/sports/global/italy.xml"; 
String s2 = "D:\\chinamaga\\1.xml";
URL urlfile = null; 
HttpURLConnection httpUrl = null; 
BufferedInputStream bis = null; 
BufferedOutputStream bos = null; 
File f = new File(s2);
InputStream in = null; try//网络文件

     urlfile = new URL(s1); 
     httpUrl = (HttpURLConnection)urlfile.openConnection(); 
              httpUrl.connect(); 
     bis = new BufferedInputStream(httpUrl.getInputStream());
     DataInputStream ins = new DataInputStream(httpUrl.getInputStream());
              DataOutputStream out = new DataOutputStream(new FileOutputStream("d:\\chinamaga\\2.xml"));
     byte[] buffer = new byte[4096];
     int count = 0;
     while ((count = ins.read(buffer)) > 0) 
     {
out.write(buffer, 0, count);
     }
    out.close();
    in.close();
         }
catch(Exception e)

      System.out.println("error:"+e.toString()); 
}
         System.out.println("rss");
     }
}
此文件可以运行,请高手指点,为什么写到本地的文件1.xml中,中文都是乱码,希望高手指点