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
求各位大佬解答