HDFS-12542. Update javadoc and documentation for listStatus. Contributed by Ajay Kumar.

This commit is contained in:
Arpit Agarwal 2017-10-11 12:29:35 -07:00
parent bb0a742aac
commit 8acdf5c274
3 changed files with 33 additions and 6 deletions

View File

@ -1495,6 +1495,15 @@ protected URL getResolvedUrl(final HttpURLConnection connection
}
}
/**
* Get {@link FileStatus} of files/directories in the given path. If path
* corresponds to a file then {@link FileStatus} of that file is returned.
* Else if path represents a directory then {@link FileStatus} of all
* files/directories inside given path is returned.
*
* @param f given path
* @return the statuses of the files/directories in the given path
*/
@Override
public FileStatus[] listStatus(final Path f) throws IOException {
statistics.incrementReadOps(1);
@ -1519,6 +1528,13 @@ FileStatus[] decodeResponse(Map<?,?> json) {
private static final byte[] EMPTY_ARRAY = new byte[] {};
/**
* Get DirectoryEntries of the given path. DirectoryEntries contains an array
* of {@link FileStatus}, as well as iteration information.
*
* @param f given path
* @return DirectoryEntries for given path
*/
@Override
public DirectoryEntries listStatusBatch(Path f, byte[] token) throws
FileNotFoundException, IOException {

View File

@ -705,14 +705,13 @@ private FileStatus[] toFileStatuses(JSONObject json, Path f) {
}
/**
* List the statuses of the files/directories in the given path if the path is
* a directory.
* Get {@link FileStatus} of files/directories in the given path. If path
* corresponds to a file then {@link FileStatus} of that file is returned.
* Else if path represents a directory then {@link FileStatus} of all
* files/directories inside given path is returned.
*
* @param f given path
*
* @return the statuses of the files/directories in the given patch
*
* @throws IOException
* @return the statuses of the files/directories in the given path
*/
@Override
public FileStatus[] listStatus(Path f) throws IOException {
@ -725,6 +724,13 @@ public FileStatus[] listStatus(Path f) throws IOException {
return toFileStatuses(json, f);
}
/**
* Get {@link DirectoryEntries} of the given path. {@link DirectoryEntries}
* contains an array of {@link FileStatus}, as well as iteration information.
*
* @param f given path
* @return {@link DirectoryEntries} for given path
*/
@Override
public DirectoryEntries listStatusBatch(Path f, byte[] token) throws
FileNotFoundException, IOException {

View File

@ -467,6 +467,8 @@ See also: [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).getFileSt
{
"accessTime" : 1320171722771,
"blockSize" : 33554432,
"childrenNum" : 0,
"fileId" : 16388,
"group" : "supergroup",
"length" : 24930,
"modificationTime": 1320171722771,
@ -474,11 +476,14 @@ See also: [FileSystem](../../api/org/apache/hadoop/fs/FileSystem.html).getFileSt
"pathSuffix" : "a.patch",
"permission" : "644",
"replication" : 1,
"storagePolicy" : 0,
"type" : "FILE"
},
{
"accessTime" : 0,
"blockSize" : 0,
"childrenNum" : 0,
"fileId" : 16389,
"group" : "supergroup",
"length" : 0,
"modificationTime": 1320895981256,