1 import org.apache.hadoop.conf.Configuration;
2 import org.apache.hadoop.fs.FSDataInputStream;
3 import org.apache.hadoop.fs.FSDataOutputStream;
4 import org.apache.hadoop.fs.FileStatus;
5 import org.apache.hadoop.fs.FileSystem;
6 import org.apache.hadoop.fs.Path;
7 public class Var_init {
8 public Configuration conf ;
9 public String s_localFilePath;
10 public String s_remoteFilePath;
11 public Path p_remoteFilePath;
12 public Path p_localFilePath;
13 public FileSystem fs;
14 public FSDataInputStream in;
15 public FSDataOutputStream out;
16 public FileStatus fileinfo;
17 Var_init()
18 {
19 try
20 {
21 s_localFilePath = "/home/hadoop/Desktop/QWQ.txt";
22 p_localFilePath = new Path(s_localFilePath);
23 s_remoteFilePath = "/user/tinyy/QWQ.txt";
24 p_remoteFilePath = new Path(s_remoteFilePath);
25 conf = new Configuration();
26 conf.set("fs.defaultFS", "hdfs://localhost:9000");
27 conf.set("dfs.client.block.write.replace-datanode-on-failure.policy", "NEVER");
28 fs = FileSystem.get(conf);
29 }
30 catch(Exception E)
31 {
32 E.printStackTrace();
33 }
34 }
35 }