code: private ObjectMetadata getObjectMetadataUsingRange(final PresignedUrlDownloadRequest request) {
          PresignedUrlDownloadRequest copy = request.clone();
  
          try {
              return s3.download(copy.withRange(0, 1))
                       .getS3Object()
                       .getObjectMetadata();
          } catch (AmazonS3Exception exception) {
              // This handles error case when trying a range GET on object with zero size
              if (exception.getStatusCode() == 416 && "InvalidRange".equals(exception.getErrorCode())) {
                  return null;
              }
              throw exception;
          }
      }
docs: Returns the object metadata using the {@link PresignedUrlDownloadRequest}.
  Returns null if object size is zero.