-
Notifications
You must be signed in to change notification settings - Fork 8
/
2.3.6.txt
50 lines (36 loc) · 1.21 KB
/
2.3.6.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Функциональность какой команды (или команд) shell-клиента реализует программа:
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IOUtils;
import java.io.InputStream;
public class SomeAction {
public static void main(String[] args) throws Exception {
if (args.length < 2) {
System.err.println("Bad arguments");
}
Path source_path = new Path(args[0]);
Path target_path = new Path(args[1]);
Configuration conf = new Configuration();
FileSystem source_fs = FileSystem.get(source_path.toUri(), conf);
FileSystem target_fs = FileSystem.get(target_path.toUri(), conf);
FSDataOutputStream output = target_fs.create(target_path);
InputStream input = null;
try{
input = source_fs.open(source_path);
IOUtils.copyBytes(input, output, conf);
} finally {
IOUtils.closeStream(input);
IOUtils.closeStream(output);
}
}
}
-cat
-put +
-text
-mv
-cp +
-mkdir
-get +
-tail