private static HdfsFileStatus createHdfsFileStatus ( byte [ ] path , INode node ) { long size = 0 ; // length is zero for directories short replication = 0 ; long blocksize = 0 ; if ( node instanceof INodeFile ) { INodeFile fileNode = ( INodeFile ) node ; size = fileNode . getFileSize ( ) ; replication = fileNode . getReplication ( ) ; blocksize = fileNode . getPreferredBlockSize ( ) ; } else if ( node . isDirectory ( ) ) { INodeDirectory dirNode = ( INodeDirectory ) node ; //length is used to represent the number of children for directories. size = dirNode . getChildren ( ) . size ( ) ; } return new HdfsFileStatus ( size , node . isDirectory ( ) , replication , blocksize , node . getModificationTime ( ) , node . getAccessTime ( ) , node . getFsPermission ( ) , node . getUserName ( ) , node . getGroupName ( ) , path ) ; }
Create HdfsFileStatus by file INode