标签:sts inpu system test 启动 plain padding line get
1
2
3
4
5
|
< property > < name >hadoop.tmp.dir</ name > < value >/var/hadoop</ value > </ property > |
1
2
3
4
5
|
< property > < name >dfs.permissions.enabled</ name > < value >false</ value > </ property > |
URL.setURLStreamHandlerFactory(new FsUrlStreamHandlerFactory());
InputStream in = new URL("hdfs://192.168.56.100:9000/test.data").openStream();
IOUtils.copyBytes(in, System.out, 4096, true);
Configuration conf = new Configuration();
conf.set("fs.defaultFS", "hdfs://192.168.56.100:9000");
FileSystem fileSystem = FileSystem.get(conf);
boolean b = fileSystem.exists(new Path("/hello"));
System.out.println(b);
boolean success = fileSystem.mkdirs(new Path("/mashibing"));
System.out.println(success);
success = fileSystem.delete(new Path("/mashibing"), true);
System.out.println(success);
FSDataOutputStream out = fileSystem.create(new Path("/test.data"), true);
FileInputStream fis = new FileInputStream("c:/test/core-site.xml");
IOUtils.copyBytes(fis, out, 4096, true);
FileStatus[] statuses = fileSystem.listStatus(new Path("/"));
//System.out.println(statuses.length);
for(FileStatus status : statuses) {
System.out.println(status.getPath());
System.out.println(status.getPermission());
System.out.println(status.getReplication());
}
标签:sts inpu system test 启动 plain padding line get
原文地址:http://www.cnblogs.com/Jxiaobai/p/6669011.html