private int calculateUriPermissionFlags(final boolean read, final boolean write) {
        return (read ? Intent.FLAG_GRANT_READ_URI_PERMISSION : 0) | (write ? Intent.FLAG_GRANT_WRITE_URI_PERMISSION : 0);
    }
Gets the Folder File; creates it if necessary and performs all possible error handlings.
This is used for locations of Type DOCUMENT and FILE
<br
This method is in many respects the core method of this class

@param folder folder to get file for
@return file folder, or null if creation/retrieving was not at all possible
main/src/main/java/cgeo/geocaching/storage/DocumentContentAccessor.java