-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSeaLevel.java
More file actions
95 lines (67 loc) · 2.55 KB
/
Copy pathSeaLevel.java
File metadata and controls
95 lines (67 loc) · 2.55 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package HadoopProject;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Scanner;
import org.apache.hadoop.fs.FsUrlStreamHandlerFactory;
import org.apache.hadoop.io.IOUtils;
public class SeaLevel {
static {
URL.setURLStreamHandlerFactory(new FsUrlStreamHandlerFactory());
}
public static void main(String[] args) throws MalformedURLException, IOException {
// TODO Auto-generated method stub
InputStream in = null;
while (true){
System.out.println("----------------------------");
System.out.println("1901 ~ 1950년 해수면 지표");
System.out.println("1. 년도별 최고해수면");
System.out.println("2. 년도별 최저해수면");
System.out.println("3. 평균 해수면");
System.out.println("4. 프로그램 종료");
System.out.println("----------------------------");
System.out.println(">");
Scanner sc = new Scanner(System.in);
int choice = sc.nextInt();
if (choice == 1 ) {
String str = "http://192.168.204.128:50070/webhdfs/v1/HighSeaLevel?op=OPEN";
try {
in = new URL(str).openStream();
IOUtils.copyBytes(in, System.out, 4096, false);
}
finally {
IOUtils.closeStream(in);
}
}
else if (choice == 2) {
String str1 = "http://192.168.204.128:50070/webhdfs/v1/LowSeaLevel?op=OPEN";
try {
in = new URL(str1).openStream();
IOUtils.copyBytes(in, System.out, 4096, false);
}
finally {
IOUtils.closeStream(in);
}
}
else if (choice == 3) {
String str2 = "http://192.168.204.128:50070/webhdfs/v1/balance?op=OPEN";
try {
in = new URL(str2).openStream();
IOUtils.copyBytes(in, System.out, 4096, false);
}
finally {
IOUtils.closeStream(in);
}
}
else if (choice == 4) {
System.out.println("프로그램 종료");
System.out.println("안녕히계세요.");
System.exit(0);
}
else {
System.out.println("다시 입력해주세요.");
}
}
}
}