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

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

Introduction

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

Prototype

public FSDataOutputStream create(Path f, boolean overwrite, int bufferSize, Progressable progress)
        throws IOException 

Source Link

Document

Create an FSDataOutputStream at the indicated Path with write-progress reporting.

Usage

From source file:WriteHdfs.java

License:Open Source License

static void writehdfs(String filename, long length) throws IOException {
    FileSystem fs = FileSystem.get(new Configuration());
    FSDataOutputStream fos = fs.create(new Path(filename), true, 1024 * 1024, null);
    for (int i = 0; i < length / data.length; i++) {
        fos.write(data);//from   www. jav a2  s .c  o m
    }
    fos.close();
}

From source file:com.ibm.bi.dml.runtime.matrix.data.UnPaddedOutputFormat.java

License:Open Source License

@Override
public RecordWriter<K, V> getRecordWriter(FileSystem ignored, JobConf job, String name, Progressable progress)
        throws IOException {
    Path file = FileOutputFormat.getTaskOutputPath(job, name);
    FileSystem fs = file.getFileSystem(job);
    FSDataOutputStream fileOut = fs.create(file, true, job.getInt("io.file.buffer.size", 4096), progress);
    return new UnpaddedRecordWriter<K, V>(fileOut);
}