code: String getItemName(URI path) {
      Preconditions.checkNotNull(path);
  
      // There is no leaf item for the root path.
      if (path.equals(GCS_ROOT)) {
        return null;
      }
  
      StorageResourceId resourceId = pathCodec.validatePathAndGetId(path, true);
  
      if (resourceId.isBucket()) {
        return resourceId.getBucketName();
      }
  
      int index;
      String objectName = resourceId.getObjectName();
      if (FileInfo.objectHasDirectoryPath(objectName)) {
        index = objectName.lastIndexOf(PATH_DELIMITER, objectName.length() - 2);
      } else {
        index = objectName.lastIndexOf(PATH_DELIMITER);
      }
      return index < 0 ? objectName : objectName.substring(index + 1);
    }
docs: Gets the leaf item of the given path.