Example usage for org.apache.hadoop.fs FileSystem createFile

List of usage examples for org.apache.hadoop.fs FileSystem createFile

Introduction

In this page you can find the example usage for org.apache.hadoop.fs FileSystem createFile.

Prototype

public FSDataOutputStreamBuilder createFile(Path path) 

Source Link

Document

Create a new FSDataOutputStreamBuilder for the file with path.

Usage

From source file:org.apache.pulsar.io.hdfs.sink.HdfsAbstractSink.java

License:Apache License

@SuppressWarnings("rawtypes")
protected final FSDataOutputStreamBuilder getOutputStreamBuilder() throws IOException {
    Path path = getPath();/*w  w w  .  j av a 2 s. co  m*/
    FileSystem fs = getFileSystemAsUser(getConfiguration(), getUserGroupInformation());
    FSDataOutputStreamBuilder builder = fs.exists(path) ? fs.appendFile(path) : fs.createFile(path);
    return builder.recursive().permission(new FsPermission(FsAction.ALL, FsAction.ALL, FsAction.ALL));
}