public static final FileAttribute < GroupPrincipal > getGroupAsAttribute ( String group ) throws IOException { if ( supports ( "posix" ) ) { UserPrincipalLookupService upls = FileSystems . getDefault ( ) . getUserPrincipalLookupService ( ) ; GroupPrincipal grp = upls . lookupPrincipalByGroupName ( group ) ; return new FileAttributeImpl <> ( "posix:group" , grp ) ; } else { return null ; } }
Return file group as attribute if posix supported . Otherwise returns null .