|
@@ -107,13 +107,13 @@ import static org.apache.hadoop.fs.impl.PathCapabilitiesSupport.validatePathCapa
|
|
|
* All user code that may potentially use the Hadoop Distributed
|
|
|
* File System should be written to use a FileSystem object or its
|
|
|
* successor, {@link FileContext}.
|
|
|
- *
|
|
|
+ * </p>
|
|
|
* <p>
|
|
|
* The local implementation is {@link LocalFileSystem} and distributed
|
|
|
* implementation is DistributedFileSystem. There are other implementations
|
|
|
* for object stores and (outside the Apache Hadoop codebase),
|
|
|
* third party filesystems.
|
|
|
- * <p>
|
|
|
+ * </p>
|
|
|
* Notes
|
|
|
* <ol>
|
|
|
* <li>The behaviour of the filesystem is
|
|
@@ -136,13 +136,12 @@ import static org.apache.hadoop.fs.impl.PathCapabilitiesSupport.validatePathCapa
|
|
|
* New methods may be marked as Unstable or Evolving for their initial release,
|
|
|
* as a warning that they are new and may change based on the
|
|
|
* experience of use in applications.
|
|
|
- * <p></p>
|
|
|
+ * <p>
|
|
|
* <b>Important note for developers</b>
|
|
|
- * <p></p>
|
|
|
+ * </p>
|
|
|
* If you are making changes here to the public API or protected methods,
|
|
|
* you must review the following subclasses and make sure that
|
|
|
* they are filtering/passing through new methods as appropriate.
|
|
|
- * <p></p>
|
|
|
*
|
|
|
* {@link FilterFileSystem}: methods are passed through. If not,
|
|
|
* then {@code TestFilterFileSystem.MustNotImplement} must be
|
|
@@ -151,21 +150,22 @@ import static org.apache.hadoop.fs.impl.PathCapabilitiesSupport.validatePathCapa
|
|
|
* {@link #hasPathCapability(Path, String)} then
|
|
|
* {@link FilterFileSystem#hasPathCapability(Path, String)}
|
|
|
* must return false, always.
|
|
|
- * <p></p>
|
|
|
+ * <p>
|
|
|
* {@link ChecksumFileSystem}: checksums are created and
|
|
|
* verified.
|
|
|
- * <p></p>
|
|
|
+ * </p>
|
|
|
* {@code TestHarFileSystem} will need its {@code MustNotImplement}
|
|
|
* interface updated.
|
|
|
- * <p></p>
|
|
|
*
|
|
|
+ * <p>
|
|
|
* There are some external places your changes will break things.
|
|
|
* Do co-ordinate changes here.
|
|
|
- * <p></p>
|
|
|
+ * </p>
|
|
|
*
|
|
|
* HBase: HBoss
|
|
|
- * <p></p>
|
|
|
+ * <p>
|
|
|
* Hive: HiveShim23
|
|
|
+ * </p>
|
|
|
* {@code shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java}
|
|
|
*
|
|
|
*****************************************************************/
|
|
@@ -284,6 +284,8 @@ public abstract class FileSystem extends Configured
|
|
|
/**
|
|
|
* Returns the configured FileSystem implementation.
|
|
|
* @param conf the configuration to use
|
|
|
+ * @return FileSystem.
|
|
|
+ * @throws IOException If an I/O error occurred.
|
|
|
*/
|
|
|
public static FileSystem get(Configuration conf) throws IOException {
|
|
|
return get(getDefaultUri(conf), conf);
|
|
@@ -377,6 +379,7 @@ public abstract class FileSystem extends Configured
|
|
|
* implement that method.
|
|
|
*
|
|
|
* @see #canonicalizeUri(URI)
|
|
|
+ * @return the URI of this filesystem.
|
|
|
*/
|
|
|
protected URI getCanonicalUri() {
|
|
|
return canonicalizeUri(getUri());
|
|
@@ -393,6 +396,7 @@ public abstract class FileSystem extends Configured
|
|
|
* not specified and if {@link #getDefaultPort()} returns a
|
|
|
* default port.
|
|
|
*
|
|
|
+ * @param uri url.
|
|
|
* @return URI
|
|
|
* @see NetUtils#getCanonicalUri(URI, int)
|
|
|
*/
|
|
@@ -456,11 +460,21 @@ public abstract class FileSystem extends Configured
|
|
|
: null;
|
|
|
}
|
|
|
|
|
|
- /** @deprecated call {@link #getUri()} instead.*/
|
|
|
+ /**
|
|
|
+ * @return uri to string.
|
|
|
+ * @deprecated call {@link #getUri()} instead.
|
|
|
+ */
|
|
|
@Deprecated
|
|
|
public String getName() { return getUri().toString(); }
|
|
|
|
|
|
- /** @deprecated call {@link #get(URI, Configuration)} instead. */
|
|
|
+ /**
|
|
|
+ * @deprecated call {@link #get(URI, Configuration)} instead.
|
|
|
+ *
|
|
|
+ * @param name name.
|
|
|
+ * @param conf configuration.
|
|
|
+ * @return file system.
|
|
|
+ * @throws IOException If an I/O error occurred.
|
|
|
+ */
|
|
|
@Deprecated
|
|
|
public static FileSystem getNamed(String name, Configuration conf)
|
|
|
throws IOException {
|
|
@@ -515,6 +529,9 @@ public abstract class FileSystem extends Configured
|
|
|
* configuration and URI, cached and returned to the caller.
|
|
|
* </li>
|
|
|
* </ol>
|
|
|
+ * @param uri uri of the filesystem.
|
|
|
+ * @param conf configrution.
|
|
|
+ * @return filesystem instance.
|
|
|
* @throws IOException if the FileSystem cannot be instantiated.
|
|
|
*/
|
|
|
public static FileSystem get(URI uri, Configuration conf) throws IOException {
|
|
@@ -544,7 +561,7 @@ public abstract class FileSystem extends Configured
|
|
|
/**
|
|
|
* Returns the FileSystem for this URI's scheme and authority and the
|
|
|
* given user. Internally invokes {@link #newInstance(URI, Configuration)}
|
|
|
- * @param uri of the filesystem
|
|
|
+ * @param uri uri of the filesystem.
|
|
|
* @param conf the configuration to use
|
|
|
* @param user to perform the get as
|
|
|
* @return filesystem instance
|
|
@@ -862,6 +879,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @param start offset into the given file
|
|
|
* @param len length for which to get locations for
|
|
|
* @throws IOException IO failure
|
|
|
+ * @return block location array.
|
|
|
*/
|
|
|
public BlockLocation[] getFileBlockLocations(FileStatus file,
|
|
|
long start, long len) throws IOException {
|
|
@@ -902,6 +920,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @param len length for which to get locations for
|
|
|
* @throws FileNotFoundException when the path does not exist
|
|
|
* @throws IOException IO failure
|
|
|
+ * @return block location array.
|
|
|
*/
|
|
|
public BlockLocation[] getFileBlockLocations(Path p,
|
|
|
long start, long len) throws IOException {
|
|
@@ -964,6 +983,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @param f the file name to open
|
|
|
* @param bufferSize the size of the buffer to be used.
|
|
|
* @throws IOException IO failure
|
|
|
+ * @return input stream.
|
|
|
*/
|
|
|
public abstract FSDataInputStream open(Path f, int bufferSize)
|
|
|
throws IOException;
|
|
@@ -972,6 +992,7 @@ public abstract class FileSystem extends Configured
|
|
|
* Opens an FSDataInputStream at the indicated Path.
|
|
|
* @param f the file to open
|
|
|
* @throws IOException IO failure
|
|
|
+ * @return input stream.
|
|
|
*/
|
|
|
public FSDataInputStream open(Path f) throws IOException {
|
|
|
return open(f, getConf().getInt(IO_FILE_BUFFER_SIZE_KEY,
|
|
@@ -989,6 +1010,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @throws IOException IO failure
|
|
|
* @throws UnsupportedOperationException If {@link #open(PathHandle, int)}
|
|
|
* not overridden by subclass
|
|
|
+ * @return input stream.
|
|
|
*/
|
|
|
public FSDataInputStream open(PathHandle fd) throws IOException {
|
|
|
return open(fd, getConf().getInt(IO_FILE_BUFFER_SIZE_KEY,
|
|
@@ -1006,6 +1028,7 @@ public abstract class FileSystem extends Configured
|
|
|
* not satisfied
|
|
|
* @throws IOException IO failure
|
|
|
* @throws UnsupportedOperationException If not overridden by subclass
|
|
|
+ * @return input stream.
|
|
|
*/
|
|
|
public FSDataInputStream open(PathHandle fd, int bufferSize)
|
|
|
throws IOException {
|
|
@@ -1023,6 +1046,7 @@ public abstract class FileSystem extends Configured
|
|
|
* not overridden by subclass.
|
|
|
* @throws UnsupportedOperationException If this FileSystem cannot enforce
|
|
|
* the specified constraints.
|
|
|
+ * @return path handle.
|
|
|
*/
|
|
|
public final PathHandle getPathHandle(FileStatus stat, HandleOpt... opt) {
|
|
|
// method is final with a default so clients calling getPathHandle(stat)
|
|
@@ -1038,6 +1062,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @param stat Referent in the target FileSystem
|
|
|
* @param opt Constraints that determine the validity of the
|
|
|
* {@link PathHandle} reference.
|
|
|
+ * @return path handle.
|
|
|
*/
|
|
|
protected PathHandle createPathHandle(FileStatus stat, HandleOpt... opt) {
|
|
|
throw new UnsupportedOperationException();
|
|
@@ -1048,6 +1073,7 @@ public abstract class FileSystem extends Configured
|
|
|
* Files are overwritten by default.
|
|
|
* @param f the file to create
|
|
|
* @throws IOException IO failure
|
|
|
+ * @return output stream.
|
|
|
*/
|
|
|
public FSDataOutputStream create(Path f) throws IOException {
|
|
|
return create(f, true);
|
|
@@ -1059,6 +1085,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @param overwrite if a file with this name already exists, then if true,
|
|
|
* the file will be overwritten, and if false an exception will be thrown.
|
|
|
* @throws IOException IO failure
|
|
|
+ * @return output stream.
|
|
|
*/
|
|
|
public FSDataOutputStream create(Path f, boolean overwrite)
|
|
|
throws IOException {
|
|
@@ -1076,6 +1103,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @param f the file to create
|
|
|
* @param progress to report progress
|
|
|
* @throws IOException IO failure
|
|
|
+ * @return output stream.
|
|
|
*/
|
|
|
public FSDataOutputStream create(Path f, Progressable progress)
|
|
|
throws IOException {
|
|
@@ -1092,6 +1120,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @param f the file to create
|
|
|
* @param replication the replication factor
|
|
|
* @throws IOException IO failure
|
|
|
+ * @return output stream1
|
|
|
*/
|
|
|
public FSDataOutputStream create(Path f, short replication)
|
|
|
throws IOException {
|
|
@@ -1110,6 +1139,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @param replication the replication factor
|
|
|
* @param progress to report progress
|
|
|
* @throws IOException IO failure
|
|
|
+ * @return output stream.
|
|
|
*/
|
|
|
public FSDataOutputStream create(Path f, short replication,
|
|
|
Progressable progress) throws IOException {
|
|
@@ -1127,6 +1157,7 @@ public abstract class FileSystem extends Configured
|
|
|
* the file will be overwritten, and if false an error will be thrown.
|
|
|
* @param bufferSize the size of the buffer to be used.
|
|
|
* @throws IOException IO failure
|
|
|
+ * @return output stream.
|
|
|
*/
|
|
|
public FSDataOutputStream create(Path f,
|
|
|
boolean overwrite,
|
|
@@ -1146,7 +1177,9 @@ public abstract class FileSystem extends Configured
|
|
|
* @param overwrite if a file with this name already exists, then if true,
|
|
|
* the file will be overwritten, and if false an error will be thrown.
|
|
|
* @param bufferSize the size of the buffer to be used.
|
|
|
+ * @param progress to report progress.
|
|
|
* @throws IOException IO failure
|
|
|
+ * @return output stream.
|
|
|
*/
|
|
|
public FSDataOutputStream create(Path f,
|
|
|
boolean overwrite,
|
|
@@ -1166,7 +1199,9 @@ public abstract class FileSystem extends Configured
|
|
|
* the file will be overwritten, and if false an error will be thrown.
|
|
|
* @param bufferSize the size of the buffer to be used.
|
|
|
* @param replication required block replication for the file.
|
|
|
+ * @param blockSize the size of the buffer to be used.
|
|
|
* @throws IOException IO failure
|
|
|
+ * @return output stream.
|
|
|
*/
|
|
|
public FSDataOutputStream create(Path f,
|
|
|
boolean overwrite,
|
|
@@ -1184,7 +1219,10 @@ public abstract class FileSystem extends Configured
|
|
|
* the file will be overwritten, and if false an error will be thrown.
|
|
|
* @param bufferSize the size of the buffer to be used.
|
|
|
* @param replication required block replication for the file.
|
|
|
+ * @param blockSize the size of the buffer to be used.
|
|
|
+ * @param progress to report progress.
|
|
|
* @throws IOException IO failure
|
|
|
+ * @return output stream.
|
|
|
*/
|
|
|
public FSDataOutputStream create(Path f,
|
|
|
boolean overwrite,
|
|
@@ -1211,6 +1249,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @param progress the progress reporter
|
|
|
* @throws IOException IO failure
|
|
|
* @see #setPermission(Path, FsPermission)
|
|
|
+ * @return output stream.
|
|
|
*/
|
|
|
public abstract FSDataOutputStream create(Path f,
|
|
|
FsPermission permission,
|
|
@@ -1232,6 +1271,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @param progress the progress reporter
|
|
|
* @throws IOException IO failure
|
|
|
* @see #setPermission(Path, FsPermission)
|
|
|
+ * @return output stream.
|
|
|
*/
|
|
|
public FSDataOutputStream create(Path f,
|
|
|
FsPermission permission,
|
|
@@ -1258,6 +1298,7 @@ public abstract class FileSystem extends Configured
|
|
|
* found in conf will be used.
|
|
|
* @throws IOException IO failure
|
|
|
* @see #setPermission(Path, FsPermission)
|
|
|
+ * @return output stream.
|
|
|
*/
|
|
|
public FSDataOutputStream create(Path f,
|
|
|
FsPermission permission,
|
|
@@ -1279,6 +1320,16 @@ public abstract class FileSystem extends Configured
|
|
|
* the permission with umask before calling this method.
|
|
|
* This a temporary method added to support the transition from FileSystem
|
|
|
* to FileContext for user applications.
|
|
|
+ *
|
|
|
+ * @param f path.
|
|
|
+ * @param absolutePermission permission.
|
|
|
+ * @param flag create flag.
|
|
|
+ * @param bufferSize buffer size.
|
|
|
+ * @param replication replication.
|
|
|
+ * @param blockSize block size.
|
|
|
+ * @param progress progress.
|
|
|
+ * @param checksumOpt check sum opt.
|
|
|
+ * @return output stream.
|
|
|
* @throws IOException IO failure
|
|
|
*/
|
|
|
@Deprecated
|
|
@@ -1333,6 +1384,11 @@ public abstract class FileSystem extends Configured
|
|
|
* with umask before calling this method.
|
|
|
* This a temporary method added to support the transition from FileSystem
|
|
|
* to FileContext for user applications.
|
|
|
+ *
|
|
|
+ * @param f the path.
|
|
|
+ * @param absolutePermission permission.
|
|
|
+ * @param createParent create parent.
|
|
|
+ * @throws IOException IO failure.
|
|
|
*/
|
|
|
@Deprecated
|
|
|
protected void primitiveMkdir(Path f, FsPermission absolutePermission,
|
|
@@ -1372,6 +1428,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @param progress the progress reporter
|
|
|
* @throws IOException IO failure
|
|
|
* @see #setPermission(Path, FsPermission)
|
|
|
+ * @return output stream.
|
|
|
*/
|
|
|
public FSDataOutputStream createNonRecursive(Path f,
|
|
|
boolean overwrite,
|
|
@@ -1395,6 +1452,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @param progress the progress reporter
|
|
|
* @throws IOException IO failure
|
|
|
* @see #setPermission(Path, FsPermission)
|
|
|
+ * @return output stream.
|
|
|
*/
|
|
|
public FSDataOutputStream createNonRecursive(Path f, FsPermission permission,
|
|
|
boolean overwrite, int bufferSize, short replication, long blockSize,
|
|
@@ -1418,6 +1476,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @param progress the progress reporter
|
|
|
* @throws IOException IO failure
|
|
|
* @see #setPermission(Path, FsPermission)
|
|
|
+ * @return output stream.
|
|
|
*/
|
|
|
public FSDataOutputStream createNonRecursive(Path f, FsPermission permission,
|
|
|
EnumSet<CreateFlag> flags, int bufferSize, short replication, long blockSize,
|
|
@@ -1432,6 +1491,7 @@ public abstract class FileSystem extends Configured
|
|
|
* <i>Important: the default implementation is not atomic</i>
|
|
|
* @param f path to use for create
|
|
|
* @throws IOException IO failure
|
|
|
+ * @return if create new file success true,not false.
|
|
|
*/
|
|
|
public boolean createNewFile(Path f) throws IOException {
|
|
|
if (exists(f)) {
|
|
@@ -1452,6 +1512,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @throws IOException IO failure
|
|
|
* @throws UnsupportedOperationException if the operation is unsupported
|
|
|
* (default).
|
|
|
+ * @return output stream.
|
|
|
*/
|
|
|
public FSDataOutputStream append(Path f) throws IOException {
|
|
|
return append(f, getConf().getInt(IO_FILE_BUFFER_SIZE_KEY,
|
|
@@ -1466,6 +1527,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @throws IOException IO failure
|
|
|
* @throws UnsupportedOperationException if the operation is unsupported
|
|
|
* (default).
|
|
|
+ * @return output stream.
|
|
|
*/
|
|
|
public FSDataOutputStream append(Path f, int bufferSize) throws IOException {
|
|
|
return append(f, bufferSize, null);
|
|
@@ -1479,6 +1541,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @throws IOException IO failure
|
|
|
* @throws UnsupportedOperationException if the operation is unsupported
|
|
|
* (default).
|
|
|
+ * @return output stream.
|
|
|
*/
|
|
|
public abstract FSDataOutputStream append(Path f, int bufferSize,
|
|
|
Progressable progress) throws IOException;
|
|
@@ -1517,7 +1580,7 @@ public abstract class FileSystem extends Configured
|
|
|
* This is the default behavior.
|
|
|
* @param src file name
|
|
|
* @param replication new replication
|
|
|
- * @throws IOException
|
|
|
+ * @throws IOException an IO failure.
|
|
|
* @return true if successful, or the feature in unsupported;
|
|
|
* false if replication is supported but the file does not exist,
|
|
|
* or is a directory
|
|
@@ -1546,11 +1609,12 @@ public abstract class FileSystem extends Configured
|
|
|
* <p>
|
|
|
* If OVERWRITE option is not passed as an argument, rename fails
|
|
|
* if the dst already exists.
|
|
|
+ * </p>
|
|
|
* <p>
|
|
|
* If OVERWRITE option is passed as an argument, rename overwrites
|
|
|
* the dst if it is a file or an empty directory. Rename fails if dst is
|
|
|
* a non-empty directory.
|
|
|
- * <p>
|
|
|
+ * </p>
|
|
|
* Note that atomicity of rename is dependent on the file system
|
|
|
* implementation. Please refer to the file system documentation for
|
|
|
* details. This default implementation is non atomic.
|
|
@@ -1558,9 +1622,11 @@ public abstract class FileSystem extends Configured
|
|
|
* This method is deprecated since it is a temporary method added to
|
|
|
* support the transition from FileSystem to FileContext for user
|
|
|
* applications.
|
|
|
+ * </p>
|
|
|
*
|
|
|
* @param src path to be renamed
|
|
|
* @param dst new path after rename
|
|
|
+ * @param options rename options.
|
|
|
* @throws FileNotFoundException src path does not exist, or the parent
|
|
|
* path of dst does not exist.
|
|
|
* @throws FileAlreadyExistsException dest path exists and is a file
|
|
@@ -1655,6 +1721,9 @@ public abstract class FileSystem extends Configured
|
|
|
|
|
|
/**
|
|
|
* Delete a file/directory.
|
|
|
+ * @param f the path.
|
|
|
+ * @throws IOException IO failure.
|
|
|
+ * @return if delete success true, not false.
|
|
|
* @deprecated Use {@link #delete(Path, boolean)} instead.
|
|
|
*/
|
|
|
@Deprecated
|
|
@@ -1771,6 +1840,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @param f path to check
|
|
|
* @throws IOException IO failure
|
|
|
* @deprecated Use {@link #getFileStatus(Path)} instead
|
|
|
+ * @return if f is directory true, not false.
|
|
|
*/
|
|
|
@Deprecated
|
|
|
public boolean isDirectory(Path f) throws IOException {
|
|
@@ -1788,6 +1858,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @param f path to check
|
|
|
* @throws IOException IO failure
|
|
|
* @deprecated Use {@link #getFileStatus(Path)} instead
|
|
|
+ * @return if f is file true, not false.
|
|
|
*/
|
|
|
@Deprecated
|
|
|
public boolean isFile(Path f) throws IOException {
|
|
@@ -1800,6 +1871,7 @@ public abstract class FileSystem extends Configured
|
|
|
|
|
|
/**
|
|
|
* The number of bytes in a file.
|
|
|
+ * @param f the path.
|
|
|
* @return the number of bytes; 0 for a directory
|
|
|
* @deprecated Use {@link #getFileStatus(Path)} instead.
|
|
|
* @throws FileNotFoundException if the path does not resolve
|
|
@@ -1814,6 +1886,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @param f path to use
|
|
|
* @throws FileNotFoundException if the path does not resolve
|
|
|
* @throws IOException IO failure
|
|
|
+ * @return content summary.
|
|
|
*/
|
|
|
public ContentSummary getContentSummary(Path f) throws IOException {
|
|
|
FileStatus status = getFileStatus(f);
|
|
@@ -1948,9 +2021,9 @@ public abstract class FileSystem extends Configured
|
|
|
* @param f Path to list
|
|
|
* @param token opaque iteration token returned by previous call, or null
|
|
|
* if this is the first call.
|
|
|
- * @return
|
|
|
- * @throws FileNotFoundException
|
|
|
- * @throws IOException
|
|
|
+ * @return directory entries.
|
|
|
+ * @throws FileNotFoundException when the path does not exist.
|
|
|
+ * @throws IOException If an I/O error occurred.
|
|
|
*/
|
|
|
@InterfaceAudience.Private
|
|
|
protected DirectoryEntries listStatusBatch(Path f, byte[] token) throws
|
|
@@ -1981,6 +2054,8 @@ public abstract class FileSystem extends Configured
|
|
|
|
|
|
/**
|
|
|
* List corrupted file blocks.
|
|
|
+ *
|
|
|
+ * @param path the path.
|
|
|
* @return an iterator over the corrupt files under the given path
|
|
|
* (may contain duplicates if a file has more than one corrupt block)
|
|
|
* @throws UnsupportedOperationException if the operation is unsupported
|
|
@@ -2074,36 +2149,29 @@ public abstract class FileSystem extends Configured
|
|
|
* <dt> <tt> ? </tt>
|
|
|
* <dd> Matches any single character.
|
|
|
*
|
|
|
- * <p>
|
|
|
* <dt> <tt> * </tt>
|
|
|
* <dd> Matches zero or more characters.
|
|
|
*
|
|
|
- * <p>
|
|
|
* <dt> <tt> [<i>abc</i>] </tt>
|
|
|
* <dd> Matches a single character from character set
|
|
|
* <tt>{<i>a,b,c</i>}</tt>.
|
|
|
*
|
|
|
- * <p>
|
|
|
* <dt> <tt> [<i>a</i>-<i>b</i>] </tt>
|
|
|
* <dd> Matches a single character from the character range
|
|
|
* <tt>{<i>a...b</i>}</tt>. Note that character <tt><i>a</i></tt> must be
|
|
|
* lexicographically less than or equal to character <tt><i>b</i></tt>.
|
|
|
*
|
|
|
- * <p>
|
|
|
* <dt> <tt> [^<i>a</i>] </tt>
|
|
|
* <dd> Matches a single character that is not from character set or range
|
|
|
* <tt>{<i>a</i>}</tt>. Note that the <tt>^</tt> character must occur
|
|
|
* immediately to the right of the opening bracket.
|
|
|
*
|
|
|
- * <p>
|
|
|
* <dt> <tt> \<i>c</i> </tt>
|
|
|
* <dd> Removes (escapes) any special meaning of character <i>c</i>.
|
|
|
*
|
|
|
- * <p>
|
|
|
* <dt> <tt> {ab,cd} </tt>
|
|
|
* <dd> Matches a string from the string set <tt>{<i>ab, cd</i>} </tt>
|
|
|
*
|
|
|
- * <p>
|
|
|
* <dt> <tt> {ab,c{de,fh}} </tt>
|
|
|
* <dd> Matches a string from the string set <tt>{<i>ab, cde, cfh</i>}</tt>
|
|
|
*
|
|
@@ -2334,6 +2402,7 @@ public abstract class FileSystem extends Configured
|
|
|
|
|
|
/** Return the current user's home directory in this FileSystem.
|
|
|
* The default implementation returns {@code "/user/$USER/"}.
|
|
|
+ * @return the path.
|
|
|
*/
|
|
|
public Path getHomeDirectory() {
|
|
|
String username;
|
|
@@ -2396,6 +2465,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @param f path to create
|
|
|
* @param permission to apply to f
|
|
|
* @throws IOException IO failure
|
|
|
+ * @return if mkdir success true, not false.
|
|
|
*/
|
|
|
public abstract boolean mkdirs(Path f, FsPermission permission
|
|
|
) throws IOException;
|
|
@@ -2443,6 +2513,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @param delSrc whether to delete the src
|
|
|
* @param src path
|
|
|
* @param dst path
|
|
|
+ * @throws IOException IO failure.
|
|
|
*/
|
|
|
public void copyFromLocalFile(boolean delSrc, Path src, Path dst)
|
|
|
throws IOException {
|
|
@@ -2557,6 +2628,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @param fsOutputFile path of output file
|
|
|
* @param tmpLocalFile path of local tmp file
|
|
|
* @throws IOException IO failure
|
|
|
+ * @return the path.
|
|
|
*/
|
|
|
public Path startLocalOutput(Path fsOutputFile, Path tmpLocalFile)
|
|
|
throws IOException {
|
|
@@ -2604,6 +2676,7 @@ public abstract class FileSystem extends Configured
|
|
|
/**
|
|
|
* Return the total size of all files in the filesystem.
|
|
|
* @throws IOException IO failure
|
|
|
+ * @return the number of path used.
|
|
|
*/
|
|
|
public long getUsed() throws IOException {
|
|
|
Path path = new Path("/");
|
|
@@ -2612,7 +2685,9 @@ public abstract class FileSystem extends Configured
|
|
|
|
|
|
/**
|
|
|
* Return the total size of all files from a specified path.
|
|
|
+ * @param path the path.
|
|
|
* @throws IOException IO failure
|
|
|
+ * @return the number of path content summary.
|
|
|
*/
|
|
|
public long getUsed(Path path) throws IOException {
|
|
|
return getContentSummary(path).getLength();
|
|
@@ -2635,6 +2710,7 @@ public abstract class FileSystem extends Configured
|
|
|
* Return the number of bytes that large input files should be optimally
|
|
|
* be split into to minimize I/O time.
|
|
|
* @deprecated use {@link #getDefaultBlockSize(Path)} instead
|
|
|
+ * @return default block size.
|
|
|
*/
|
|
|
@Deprecated
|
|
|
public long getDefaultBlockSize() {
|
|
@@ -2687,8 +2763,8 @@ public abstract class FileSystem extends Configured
|
|
|
* In some FileSystem implementations such as HDFS metadata
|
|
|
* synchronization is essential to guarantee consistency of read requests
|
|
|
* particularly in HA setting.
|
|
|
- * @throws IOException
|
|
|
- * @throws UnsupportedOperationException
|
|
|
+ * @throws IOException If an I/O error occurred.
|
|
|
+ * @throws UnsupportedOperationException if the operation is unsupported.
|
|
|
*/
|
|
|
public void msync() throws IOException, UnsupportedOperationException {
|
|
|
throw new UnsupportedOperationException(getClass().getCanonicalName() +
|
|
@@ -2764,6 +2840,8 @@ public abstract class FileSystem extends Configured
|
|
|
|
|
|
/**
|
|
|
* See {@link FileContext#fixRelativePart}.
|
|
|
+ * @param p the path.
|
|
|
+ * @return relative part.
|
|
|
*/
|
|
|
protected Path fixRelativePart(Path p) {
|
|
|
if (p.isUriPathAbsolute()) {
|
|
@@ -2775,6 +2853,18 @@ public abstract class FileSystem extends Configured
|
|
|
|
|
|
/**
|
|
|
* See {@link FileContext#createSymlink(Path, Path, boolean)}.
|
|
|
+ *
|
|
|
+ * @param target target path.
|
|
|
+ * @param link link.
|
|
|
+ * @param createParent create parent.
|
|
|
+ * @throws AccessControlException if access is denied.
|
|
|
+ * @throws FileAlreadyExistsException when the path does not exist.
|
|
|
+ * @throws FileNotFoundException when the path does not exist.
|
|
|
+ * @throws ParentNotDirectoryException if the parent path of dest is not
|
|
|
+ * a directory.
|
|
|
+ * @throws UnsupportedFileSystemException if there was no known implementation
|
|
|
+ * for the scheme.
|
|
|
+ * @throws IOException raised on errors performing I/O.
|
|
|
*/
|
|
|
public void createSymlink(final Path target, final Path link,
|
|
|
final boolean createParent) throws AccessControlException,
|
|
@@ -2788,8 +2878,14 @@ public abstract class FileSystem extends Configured
|
|
|
|
|
|
/**
|
|
|
* See {@link FileContext#getFileLinkStatus(Path)}.
|
|
|
- * @throws FileNotFoundException when the path does not exist
|
|
|
- * @throws IOException see specific implementation
|
|
|
+ *
|
|
|
+ * @param f the path.
|
|
|
+ * @throws AccessControlException if access is denied.
|
|
|
+ * @throws FileNotFoundException when the path does not exist.
|
|
|
+ * @throws IOException raised on errors performing I/O.
|
|
|
+ * @throws UnsupportedFileSystemException if there was no known implementation
|
|
|
+ * for the scheme.
|
|
|
+ * @return file status
|
|
|
*/
|
|
|
public FileStatus getFileLinkStatus(final Path f)
|
|
|
throws AccessControlException, FileNotFoundException,
|
|
@@ -2800,6 +2896,7 @@ public abstract class FileSystem extends Configured
|
|
|
|
|
|
/**
|
|
|
* See {@link AbstractFileSystem#supportsSymlinks()}.
|
|
|
+ * @return if support symlinkls true, not false.
|
|
|
*/
|
|
|
public boolean supportsSymlinks() {
|
|
|
return false;
|
|
@@ -2807,8 +2904,11 @@ public abstract class FileSystem extends Configured
|
|
|
|
|
|
/**
|
|
|
* See {@link FileContext#getLinkTarget(Path)}.
|
|
|
+ * @param f the path.
|
|
|
* @throws UnsupportedOperationException if the operation is unsupported
|
|
|
* (default outcome).
|
|
|
+ * @throws IOException IO failure.
|
|
|
+ * @return the path.
|
|
|
*/
|
|
|
public Path getLinkTarget(Path f) throws IOException {
|
|
|
// Supporting filesystems should override this method
|
|
@@ -2818,8 +2918,11 @@ public abstract class FileSystem extends Configured
|
|
|
|
|
|
/**
|
|
|
* See {@link AbstractFileSystem#getLinkTarget(Path)}.
|
|
|
+ * @param f the path.
|
|
|
* @throws UnsupportedOperationException if the operation is unsupported
|
|
|
* (default outcome).
|
|
|
+ * @throws IOException IO failure.
|
|
|
+ * @return the path.
|
|
|
*/
|
|
|
protected Path resolveLink(Path f) throws IOException {
|
|
|
// Supporting filesystems should override this method
|
|
@@ -3223,7 +3326,7 @@ public abstract class FileSystem extends Configured
|
|
|
/**
|
|
|
* Set the source path to satisfy storage policy.
|
|
|
* @param path The source path referring to either a directory or a file.
|
|
|
- * @throws IOException
|
|
|
+ * @throws IOException If an I/O error occurred.
|
|
|
*/
|
|
|
public void satisfyStoragePolicy(final Path path) throws IOException {
|
|
|
throw new UnsupportedOperationException(
|
|
@@ -3539,7 +3642,7 @@ public abstract class FileSystem extends Configured
|
|
|
* @param conf configuration
|
|
|
* @param key key to store/retrieve this FileSystem in the cache
|
|
|
* @return a cached or newly instantiated FileSystem.
|
|
|
- * @throws IOException
|
|
|
+ * @throws IOException If an I/O error occurred.
|
|
|
*/
|
|
|
private FileSystem getInternal(URI uri, Configuration conf, Key key)
|
|
|
throws IOException{
|
|
@@ -4034,6 +4137,7 @@ public abstract class FileSystem extends Configured
|
|
|
|
|
|
/**
|
|
|
* Get or create the thread-local data associated with the current thread.
|
|
|
+ * @return statistics data.
|
|
|
*/
|
|
|
public StatisticsData getThreadStatistics() {
|
|
|
StatisticsData data = threadData.get();
|
|
@@ -4392,6 +4496,7 @@ public abstract class FileSystem extends Configured
|
|
|
/**
|
|
|
* Return the FileSystem classes that have Statistics.
|
|
|
* @deprecated use {@link #getGlobalStorageStatistics()}
|
|
|
+ * @return statistics lists.
|
|
|
*/
|
|
|
@Deprecated
|
|
|
public static synchronized List<Statistics> getAllStatistics() {
|
|
@@ -4400,6 +4505,7 @@ public abstract class FileSystem extends Configured
|
|
|
|
|
|
/**
|
|
|
* Get the statistics for a particular file system.
|
|
|
+ * @param scheme scheme.
|
|
|
* @param cls the class to lookup
|
|
|
* @return a statistics object
|
|
|
* @deprecated use {@link #getGlobalStorageStatistics()}
|
|
@@ -4434,6 +4540,7 @@ public abstract class FileSystem extends Configured
|
|
|
|
|
|
/**
|
|
|
* Print all statistics for all file systems to {@code System.out}
|
|
|
+ * @throws IOException If an I/O error occurred.
|
|
|
*/
|
|
|
public static synchronized
|
|
|
void printStatistics() throws IOException {
|
|
@@ -4474,6 +4581,7 @@ public abstract class FileSystem extends Configured
|
|
|
|
|
|
/**
|
|
|
* Get the global storage statistics.
|
|
|
+ * @return global storage statistics.
|
|
|
*/
|
|
|
public static GlobalStorageStatistics getGlobalStorageStatistics() {
|
|
|
return GlobalStorageStatistics.INSTANCE;
|