class BlobChecker implements RegistryEndpointProvider<Optional<BlobDescriptor>> {

  @Override
  public Optional<BlobDescriptor> handleHttpResponseException(ResponseException responseException)
      throws ResponseException {
    if (responseException.getStatusCode() != HttpStatusCodes.STATUS_CODE_NOT_FOUND) {
      throw responseException;
    }

    if (responseException.getContent() == null) {
      // TODO: The Google HTTP client gives null content for HEAD requests. Make the content never
      // be null, even for HEAD requests.
      return Optional.empty();
    }

    // Find a BLOB_UNKNOWN error response code.
    ErrorCodes errorCode = ErrorResponseUtil.getErrorCode(responseException);
    if (errorCode == ErrorCodes.BLOB_UNKNOWN) {
      return Optional.empty();
    }

    // BLOB_UNKNOWN was not found as a error response code.
    throw responseException;
  }

    BlobChecker(
      RegistryEndpointRequestProperties registryEndpointRequestProperties,
      DescriptorDigest blobDigest);

}