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(); } }
Java读取远程文件并显示
最新推荐文章于 2021-08-04 13:10:52 发布