- URL url = new URL(“http://localhost:8080/AriadneServer”);
- HttpURLConnection connection =(HttpURLConnection)url.openConnection();
- DataInputStream in = new DataInputStream(connection.getInputStream());
- DataOutputStream out=new DataOutputStream(new FileOutputStream(“D://suqiang//to.txt”));
- byte[] buffer = new byte[4096];
- int count = 0;
- while ((count = in.read(buffer)) > 0) {
- out.write(buffer, 0, count);
- }
- out.close();
- in.close();
根据URL从服务器端复制文件到本地java代码
最新推荐文章于 2023-03-30 16:27:06 发布