一、项目要加入的一些包:
二、下面是代码相关的:
package org.apache.hadoop.examples.yao;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
public class FileDemo {
public static void main(String[] args) throws IOException{
mkdir("test");
putFile("/home/yaokj/temp.txt","test/test.txt");
createFile("test/create.txt");
rename("test/test.txt","test/test2.txt");
System.out.println(deleteFile("test/test2.txt"));
System.out.println(getLastModifyTime("test/create.txt"));
System.out.println(isExists("test/create