List of usage examples for org.apache.hadoop.fs FileSystem create
public FSDataOutputStream create(Path f, boolean overwrite, int bufferSize, Progressable progress) throws IOException
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); }