|
@@ -830,6 +830,30 @@ public abstract class FileSystem extends Configured implements Closeable {
|
|
long blockSize,
|
|
long blockSize,
|
|
Progressable progress) throws IOException;
|
|
Progressable progress) throws IOException;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Create an FSDataOutputStream at the indicated Path with write-progress
|
|
|
|
+ * reporting.
|
|
|
|
+ * @param f the file name to open
|
|
|
|
+ * @param permission
|
|
|
|
+ * @param flags {@link CreateFlag}s to use for this stream.
|
|
|
|
+ * @param bufferSize the size of the buffer to be used.
|
|
|
|
+ * @param replication required block replication for the file.
|
|
|
|
+ * @param blockSize
|
|
|
|
+ * @param progress
|
|
|
|
+ * @throws IOException
|
|
|
|
+ * @see #setPermission(Path, FsPermission)
|
|
|
|
+ */
|
|
|
|
+ public FSDataOutputStream create(Path f,
|
|
|
|
+ FsPermission permission,
|
|
|
|
+ EnumSet<CreateFlag> flags,
|
|
|
|
+ int bufferSize,
|
|
|
|
+ short replication,
|
|
|
|
+ long blockSize,
|
|
|
|
+ Progressable progress) throws IOException {
|
|
|
|
+ // only DFS support this
|
|
|
|
+ return create(f, permission, flags.contains(CreateFlag.OVERWRITE), bufferSize, replication, blockSize, progress);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
/*.
|
|
/*.
|
|
* This create has been added to support the FileContext that processes
|
|
* This create has been added to support the FileContext that processes
|
|
@@ -954,10 +978,35 @@ public abstract class FileSystem extends Configured implements Closeable {
|
|
public FSDataOutputStream createNonRecursive(Path f, FsPermission permission,
|
|
public FSDataOutputStream createNonRecursive(Path f, FsPermission permission,
|
|
boolean overwrite, int bufferSize, short replication, long blockSize,
|
|
boolean overwrite, int bufferSize, short replication, long blockSize,
|
|
Progressable progress) throws IOException {
|
|
Progressable progress) throws IOException {
|
|
- throw new IOException("createNonRecursive unsupported for this filesystem "
|
|
|
|
- + this.getClass());
|
|
|
|
|
|
+ return createNonRecursive(f, permission,
|
|
|
|
+ overwrite ? EnumSet.of(CreateFlag.CREATE, CreateFlag.OVERWRITE)
|
|
|
|
+ : EnumSet.of(CreateFlag.CREATE), bufferSize,
|
|
|
|
+ replication, blockSize, progress);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Opens an FSDataOutputStream at the indicated Path with write-progress
|
|
|
|
+ * reporting. Same as create(), except fails if parent directory doesn't
|
|
|
|
+ * already exist.
|
|
|
|
+ * @param f the file name to open
|
|
|
|
+ * @param permission
|
|
|
|
+ * @param flags {@link CreateFlag}s to use for this stream.
|
|
|
|
+ * @param bufferSize the size of the buffer to be used.
|
|
|
|
+ * @param replication required block replication for the file.
|
|
|
|
+ * @param blockSize
|
|
|
|
+ * @param progress
|
|
|
|
+ * @throws IOException
|
|
|
|
+ * @see #setPermission(Path, FsPermission)
|
|
|
|
+ * @deprecated API only for 0.20-append
|
|
|
|
+ */
|
|
|
|
+ @Deprecated
|
|
|
|
+ public FSDataOutputStream createNonRecursive(Path f, FsPermission permission,
|
|
|
|
+ EnumSet<CreateFlag> flags, int bufferSize, short replication, long blockSize,
|
|
|
|
+ Progressable progress) throws IOException {
|
|
|
|
+ throw new IOException("createNonRecursive unsupported for this filesystem "
|
|
|
|
+ + this.getClass());
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Creates the given Path as a brand-new zero-length file. If
|
|
* Creates the given Path as a brand-new zero-length file. If
|
|
* create fails, or if it already existed, return false.
|
|
* create fails, or if it already existed, return false.
|