编程语言

img andunkafei

Java读写远程文件并显示

发表于2004/10/11 9:08:00  3349人阅读

import java.net.*;
import java.io.*;
import java.util.*;

public class ReadURLFile{

	public static void main(String[] args) throws Exception{
		URL urlfile = new URL("http://192.168.16.34/xuys/index_.html");
		BufferedReader in = new BufferedReader(new InputStreamReader(urlfile.openStream()));
		
		String content="";
		
		String inputLine = in.readLine();
		while(inputLine!=null){
			content += inputLine;
			inputLine = in.readLine();
		}			
		System.out.println(content);
		in.close();	
	}
}
阅读全文
0 0

相关文章推荐

img
取 消
img