Java Code Examples for java.nio.file.Files.setOwner()

The following are Jave code examples for showing how to use setOwner() of the java.nio.file.Files class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: cyberduck   File:   Source Code and License Vote up 5 votes
public void setUnixOwner(final Path file, final String owner) throws BackgroundException {
    try {
        final UserPrincipal principal = session.getClient().getUserPrincipalLookupService().lookupPrincipalByName(owner);
        Files.setOwner(session.toPath(file), principal);
    catch(IOException e) {
        throw new LocalExceptionMappingService().map("Failure to write attributes of {0}", e, file);