首页 新闻 会员 周边

虚拟机中HDFS上的文件下载的本地的系统老是有问题

0
悬赏园豆:200 [待解决问题]

java项目老是把String downloadPath="D:\netdisk\download\"; 变成一个文件名然后下载到项目中,是为什么呢。
不管是用流下载的方式:
FileSystem fs = FileSystem.get(URI.create(hdfsService), conf);
FSDataInputStream in = fs.open(new Path(path));
FileOutputStream out = new FileOutputStream(local);
IOUtils.copyBytes(in, out, 4096, true);

还是copyToLocalFile
FileSystem fs = FileSystem.get(URI.create(hdfsService), conf);
// fs.copyToLocalFile(path, new Path(local));
Path pt = new Path(local);
fs.copyToLocalFile(false, new Path(remote), pt, true);
只要路径是上面写的那个下载路径,都会变成下面这样存入到了项目的目录中
D^%@%netdisk@%download@%4.txt
求各位大佬解答

拜求大佬的主页 拜求大佬 | 初学一级 | 园豆:2
提问于:2021-05-03 22:52
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册