@SuppressWarnings("OctalInteger")
    private static int toMode(Set<PosixFilePermission> permissions) {
        int result = 0;
        for (PosixFilePermission permission : permissions) {
            checkNotNull(permission);
            switch (permission) {
                case OWNER_READ -> result |= 0400;
                case OWNER_WRITE -> result |= 0200;
                case OWNER_EXECUTE -> result |= 0100;
                case GROUP_READ -> result |= 0040;
                case GROUP_WRITE -> result |= 0020;
                case GROUP_EXECUTE -> result |= 0010;
                case OTHERS_READ -> result |= 0004;
                case OTHERS_WRITE -> result |= 0002;
                case OTHERS_EXECUTE -> result |= 0001;
                default -> throw new AssertionError(); // no other possible values
            }
        }
        return result;
    }
Same as {@code com.google.common.jimfs.UnixAttributeProvider} except that getUniqueId() will return user
if user is a numerical string.
testutil/src/main/java/com/yahoo/vespa/test/file/UnixUidGidAttributeProvider.java