|
25 | 25 | import org.apache.commons.logging.Log; |
26 | 26 | import org.apache.commons.logging.LogFactory; |
27 | 27 | import org.apache.hadoop.conf.Configuration; |
| 28 | +import org.apache.hadoop.fs.permission.FsPermission; |
28 | 29 | import org.apache.hadoop.util.Progressable; |
29 | 30 | import org.apache.hadoop.util.StringUtils; |
30 | 31 |
|
@@ -341,28 +342,22 @@ protected void writeChunk(byte[] b, int offset, int len, byte[] checksum) |
341 | 342 | } |
342 | 343 | } |
343 | 344 |
|
344 | | - /** |
345 | | - * Opens an FSDataOutputStream at the indicated Path with write-progress |
346 | | - * reporting. |
347 | | - * @param f the file name to open |
348 | | - * @param overwrite if a file with this name already exists, then if true, |
349 | | - * the file will be overwritten, and if false an error will be thrown. |
350 | | - * @param bufferSize the size of the buffer to be used. |
351 | | - * @param replication required block replication for the file. |
352 | | - */ |
| 345 | + /** {@inheritDoc} */ |
353 | 346 | @Override |
354 | | - public FSDataOutputStream create(Path f, boolean overwrite, int bufferSize, |
355 | | - short replication, long blockSize, Progressable progress) |
356 | | - throws IOException { |
| 347 | + public FSDataOutputStream create(Path f, FsPermission permission, |
| 348 | + boolean overwrite, int bufferSize, short replication, long blockSize, |
| 349 | + Progressable progress) throws IOException { |
357 | 350 | Path parent = f.getParent(); |
358 | 351 | if (parent != null && !mkdirs(parent)) { |
359 | 352 | throw new IOException("Mkdirs failed to create " + parent); |
360 | 353 | } |
361 | | - return new FSDataOutputStream |
362 | | - (new ChecksumFSOutputSummer |
363 | | - (this, f, overwrite, bufferSize, replication, |
364 | | - blockSize, progress), |
365 | | - null); |
| 354 | + final FSDataOutputStream out = new FSDataOutputStream( |
| 355 | + new ChecksumFSOutputSummer(this, f, overwrite, bufferSize, replication, |
| 356 | + blockSize, progress), null); |
| 357 | + if (permission != null) { |
| 358 | + setPermission(f, permission); |
| 359 | + } |
| 360 | + return out; |
366 | 361 | } |
367 | 362 |
|
368 | 363 | /** |
|
0 commit comments