Я хочу переписать функцию копирования файла из hdfs в локальный
String src = args[0]; // hdfs
String dst = args[1]; // local path
/*
* Prepare the input and output filesystems
*/
Configuration conf = new Configuration();
FileSystem inFS = FileSystem.get(URI.create(src), conf);
FileSystem outFS = FileSystem.get(URI.create(dst), conf);
/*
* Prepare the input and output streams
*/
FSDataInputStream in = null;
FSDataOutputStream out = null;
// TODO: Your implementation goes here...
in = inFS.open(new Path(src));
out = outFS.create(new Path(dst),
new Progressable() {
/*
* Print a dot whenever 64 KB of data has been written to
* the datanode pipeline.
*/
public void progress() {
System.out.print(".");
}
});
(1), когда я устанавливаю локальный путь к моему текущему директору
-> JAVA I/O error. mkdirs failed to create file
(2), когда я указываю путь к несуществующей папке
-> создается новая папка, и мой скопированный файл находится внутри.
Что мне делать?
Я полагаю, что я не должен использовать filesystem.create () ?, я?
РЕДАКТИРОВАТЬ
ссылка на библиотеку связанной файловой системы: https://hadoop.apache.org/docs/current/api/org/apache/hadoop/fs/FileSystem.html#create(org.apache.hadoop.fs.Path)