HDFS java api

This commit is contained in:
luoxiang
2019-05-01 11:28:28 +08:00
parent c84d613bcc
commit 14e6e90316
4 changed files with 259 additions and 2 deletions

View File

@@ -70,7 +70,7 @@ public class HdfsUtils {
*/
public void createAndWrite(String path, String context) throws Exception {
FSDataOutputStream out = fileSystem.create(new Path(path));
out.writeUTF(context);
out.write(context.getBytes());
out.flush();
out.close();
}