public void checkAccess()

in src/main/java/com/pastdev/jsch/nio/file/UnixSshFileSystemProvider.java [100:125]


    public void checkAccess( Path path, AccessMode... modes ) throws IOException {
        UnixSshPath unixPath = checkPath( path ).toAbsolutePath();
        String pathString = unixPath.toAbsolutePath().quotedString();

        String testCommand = unixPath.getFileSystem().getCommand( "test" );
        if ( execute( unixPath, testCommand + " -e " + pathString ).getExitCode() != 0 ) {
            throw new NoSuchFileException( pathString );
        }

        Set<AccessMode> modesSet = toSet( modes );
        if ( modesSet.contains( AccessMode.READ ) ) {
            if ( execute( unixPath, testCommand + " -r " + pathString ).getExitCode() != 0 ) {
                throw new AccessDeniedException( pathString );
            }
        }
        if ( modesSet.contains( AccessMode.WRITE ) ) {
            if ( execute( unixPath, testCommand + " -w " + pathString ).getExitCode() != 0 ) {
                throw new AccessDeniedException( pathString );
            }
        }
        if ( modesSet.contains( AccessMode.EXECUTE ) ) {
            if ( execute( unixPath, testCommand + " -x " + pathString ).getExitCode() != 0 ) {
                throw new AccessDeniedException( pathString );
            }
        }
    }