All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.fge.filesystem.posix.PermissionsSet Maven / Gradle / Ivy

package com.github.fge.filesystem.posix;

import javax.annotation.ParametersAreNonnullByDefault;
import java.nio.file.attribute.PosixFilePermission;
import java.util.EnumSet;
import java.util.Set;

@SuppressWarnings("AssignmentToCollectionOrArrayFieldFromParameter")
@ParametersAreNonnullByDefault
public final class PermissionsSet
{
    private final Set toAdd;
    private final Set toRemove;

    PermissionsSet(final Set toAdd,
        final Set toRemove)
    {
        this.toAdd = toAdd;
        this.toRemove = toRemove;
    }

    public Set modify(final Set set)
    {
        final Set ret = EnumSet.copyOf(set);

        ret.removeAll(toRemove);
        ret.addAll(toAdd);
        return ret;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy