Java API for Hadoop Distributed file system provides one important class org.apache.hadoop.fs.FileStatus for querying HDFS File System. This class encapsulates the file system meta data. We can obtain meta data about the files, directories, including file length, block size, replication, modification time, ownership, and permission information.
We can get the instance of FileStatus by calling getFileStatus() method on file system object.
Below are some of the important methods on FileStatus class.
Below is a sample program for illustrating the above methods of FileStatus class.
After compiling the above program and adding the class file location to HADOOP_CLASSPATH environment variable, then we can test the output of the program as shown below.