谁知道下面的问题?????????????
怎么样从网络上面读到一个文件(TXT)???????
------解决方案--------------------import java.io.*;
import java.net.*;
public class lesson2 {
public static void main(String arg[]){
//
try
{
URL url = new URL( "http://community.csdn.net/Expert/topic/5452/5452629.xml?temp=.5713159/ ");
InputStream is = url.openStream();
BufferedReader in = new BufferedReader(
new InputStreamReader(is));
String readLine = in.readLine();;
while (readLine != null) {
System.out.println(readLine);
readLine = in.readLine();
}
}
catch(MalformedURLException m){
System.out.print( " ");
}
catch(
IOException i){}
}
}