code: @VisibleForTesting
    protected void initMetadata(HttpHeaders headers) throws IOException {
      checkState(
          !metadataInitialized,
          "can not initialize metadata, it already initialized for '%s'", resourceIdString);
  
      long sizeFromMetadata;
      String range = headers.getContentRange();
      if (range != null) {
        sizeFromMetadata = Long.parseLong(range.substring(range.lastIndexOf('/') + 1));
      } else {
        sizeFromMetadata = headers.getContentLength();
      }
  
      String generation = headers.getFirstHeaderStringValue("x-goog-generation");
  
      initMetadata(headers.getContentEncoding(), sizeFromMetadata, generation);
    }
docs: Initializes metadata (size, encoding, etc) from HTTP {@code headers}.