code: public static final FileAttribute<UserPrincipal> getOwnerAsAttribute(String owner) throws IOException
      {
          if (supports("posix"))
          {
              UserPrincipalLookupService upls = FileSystems.getDefault().getUserPrincipalLookupService();
              UserPrincipal user = upls.lookupPrincipalByName(owner);
              return new FileAttributeImpl<>("posix:owner", user);
          }
          else
          {
              return null;
          }
      }
docs: Return file owner as attribute if posix supported. Otherwise returns null.
  @param owner
  @return
  @throws IOException