public boolean isRemovable()

in pekko-connectors-sample-ftp-to-file/src/main/java/playground/filesystem/impl/JimfsFtpFile.java [171:197]


    public boolean isRemovable() {

        // root cannot be deleted
        if ("/".equals(fileName)) {
            return false;
        }

        String fullName = getAbsolutePath();

        // we check FTPServer's write permission for this file.
        if (user.authorize(new WriteRequest(fullName)) == null) {
            return false;
        }

        // In order to maintain consistency, when possible we delete the last '/' character in the String
        int indexOfSlash = fullName.lastIndexOf('/');
        String parentFullName;
        if (indexOfSlash == 0) {
            parentFullName = "/";
        } else {
            parentFullName = fullName.substring(0, indexOfSlash);
        }

        JimfsFtpFile parentObject = new JimfsFtpFile(parentFullName,
                path.getParent(), user);
        return parentObject.isWritable();
    }