@ NotNull public static FileInfo forPath ( Path path ) { try { final BasicFileAttributes attributes = Files . readAttributes ( path , BasicFileAttributes . class ) ; return FileInfo . builder ( ) . path ( path ) . key ( attributes . fileKey ( ) ) . size ( attributes . size ( ) ) . modificationTime ( attributes . lastModifiedTime ( ) ) . build ( ) ; } catch ( Exception e ) { LOG . error ( "Couldn't get file info for path: {}" , path , e ) ; return EMPTY_FILE_INFO . toBuilder ( ) . path ( path ) . build ( ) ; } }
Create a file info for the given path .