如何用JAVA编程实现抓取某一页面的内容并保存成本地文件?

2024-11-16 06:56:06
推荐回答(2个)
回答(1):

import java.io.*;
import java.net.*;
public class server
{
public static void main(String[] args)
{
System.out.println("server starting.......");
try{
serversocket server=new serverSocker(7777);//listen7777port
Socket st=accpet();
BufferdReader br_net=new BufferdReader(new InputStreamReader)
BufferdReader br_key=new BufferdReader(new InputStreamReader)
printWriter pw=new PrintWriter(st.getOutputStream());
while(true){
String a=br_key.readLine();
pw.println(D:\);
pw.flush();

s=br_net.readLine();
system.out.println("hesays"+s);
}
}catch(Exception e){}

回答(2):

file 类可以实现 大嘴哥 给我分吧