@ Override public FileStatus [ ] listStatus ( Path hadoopPath ) throws IOException { long startTime = System . nanoTime ( ) ; Preconditions . checkArgument ( hadoopPath != null , "hadoopPath must not be null" ) ; checkOpen ( ) ; logger . atFine ( ) . log ( "GHFS.listStatus: %s" , hadoopPath ) ; URI gcsPath = getGcsPath ( hadoopPath ) ; List < FileStatus > status ; try { List < FileInfo > fileInfos = getGcsFs ( ) . listFileInfo ( gcsPath ) ; status = new ArrayList <> ( fileInfos . size ( ) ) ; String userName = getUgiUserName ( ) ; for ( FileInfo fileInfo : fileInfos ) { status . add ( getFileStatus ( fileInfo , userName ) ) ; } } catch ( FileNotFoundException fnfe ) { logger . atFine ( ) . withCause ( fnfe ) . log ( "Got fnfe: " ) ; throw new FileNotFoundException ( String . format ( "Path '%s' does not exist." , gcsPath ) ) ; } long duration = System . nanoTime ( ) - startTime ; increment ( Counter . LIST_STATUS ) ; increment ( Counter . LIST_STATUS_TIME , duration ) ; return status . toArray ( new FileStatus [ 0 ] ) ; }
Lists file status . If the given path points to a directory then the status of children is returned otherwise the status of the given file is returned .