code: @VisibleForTesting
    protected void initMetadata(
        @Nullable String encoding, long sizeFromMetadata, @Nullable String generation)
        throws IOException {
      checkState(
          !metadataInitialized,
          "can not initialize metadata, it already initialized for '%s'", resourceIdString);
      gzipEncoded = nullToEmpty(encoding).contains(GZIP_ENCODING);
      if (gzipEncoded) {
        size = Long.MAX_VALUE;
      } else {
        size = sizeFromMetadata;
      }
      randomAccess = !gzipEncoded && readOptions.getFadvise() == Fadvise.RANDOM;
      checkEncodingAndAccess();
  
      initGeneration(generation);
  
      metadataInitialized = true;
  
      logger.atFine().log(
          "Initialized metadata (gzipEncoded=%s, size=%s, randomAccess=%s, generation=%s) for '%s'",
          gzipEncoded, size, randomAccess, generation, resourceIdString);
    }
docs: Initializes metadata (size, encoding, etc) from passed parameters.