legacy/src/main/java/thredds/crawlabledataset/s3/S3URI.java
public S3URI getParent() {
        if (key == null) {
            return null;
        }

        int lastDelimPos = key.lastIndexOf(S3_DELIMITER);
        if (lastDelimPos == -1) {
            return new S3URI(bucket, null);
        } else {
            return new S3URI(bucket, key.substring(0, lastDelimPos));
        }
    }
public S3URI getParent() {
        if (key == null) {
            return null;
        }

        int lastDelimPos = key.lastIndexOf(S3_DELIMITER);
        if (lastDelimPos == -1) {
            return new S3URI(bucket, null);
        } else {
            return new S3URI(bucket, key.substring(0, lastDelimPos));
        }
    }
Returns the parent URI of this URI. The determination is completely text-based, using the
{@link #S3_DELIMITER delimiter}. If the key is {@code null}, {@code null} is returned. If it is non-{@code null},
but doesn't have a logical parent, the returned URI will have a {@code null} key (but the same bucket).
For example, the parent of {@code s3://my-bucket/my-key} (bucket="my-bucket", key="my-key") will be
{@code s3://my-bucket} (bucket=="my-bucket", key=null).

@return the parent URI of this URI.