public static String getOwnerName ( final File file ) { try { final Path path = Paths . get ( file . getAbsolutePath ( ) ) ; final FileOwnerAttributeView ownerAttributeView = Files . getFileAttributeView ( path , FileOwnerAttributeView . class ) ; return ownerAttributeView != null ? ownerAttributeView . getOwner ( ) . getName ( ) : null ; } catch ( Exception e ) { logger . warn ( "Failed to determine 'owner' of {}: {}" , file , e . getMessage ( ) ) ; return null ; } }
Determines the owner of the file .