/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public String toString() { return ToString.builder("GetObjectResponse").add("DeleteMarker", deleteMarker()).add("AcceptRanges", acceptRanges()) .add("Expiration", expiration()).add("Restore", restore()).add("LastModified", lastModified()) .add("ContentLength", contentLength()).add("ETag", eTag()).add("MissingMeta", missingMeta()) .add("VersionId", versionId()).add("CacheControl", cacheControl()) .add("ContentDisposition", contentDisposition()).add("ContentEncoding", contentEncoding()) .add("ContentLanguage", contentLanguage()).add("ContentRange", contentRange()).add("ContentType", contentType()) .add("Expires", expires()).add("WebsiteRedirectLocation", websiteRedirectLocation()) .add("ServerSideEncryption", serverSideEncryptionAsString()).add("Metadata", metadata()) .add("SSECustomerAlgorithm", sseCustomerAlgorithm()).add("SSECustomerKeyMD5", sseCustomerKeyMD5()) .add("SSEKMSKeyId", ssekmsKeyId() == null ? null : "*** Sensitive Data Redacted ***") .add("StorageClass", storageClassAsString()).add("RequestCharged", requestChargedAsString()) .add("ReplicationStatus", replicationStatusAsString()).add("PartsCount", partsCount()) .add("TagCount", tagCount()).add("ObjectLockMode", objectLockModeAsString()) .add("ObjectLockRetainUntilDate", objectLockRetainUntilDate()) .add("ObjectLockLegalHoldStatus", objectLockLegalHoldStatusAsString()).build(); }
return Optional.ofNullable(clazz.cast(lastModified())); case "ContentLength": return Optional.ofNullable(clazz.cast(contentLength())); case "ETag": return Optional.ofNullable(clazz.cast(eTag()));
hashCode = 31 * hashCode + Objects.hashCode(restore()); hashCode = 31 * hashCode + Objects.hashCode(lastModified()); hashCode = 31 * hashCode + Objects.hashCode(contentLength()); hashCode = 31 * hashCode + Objects.hashCode(eTag()); hashCode = 31 * hashCode + Objects.hashCode(missingMeta());
return Objects.equals(deleteMarker(), other.deleteMarker()) && Objects.equals(acceptRanges(), other.acceptRanges()) && Objects.equals(expiration(), other.expiration()) && Objects.equals(restore(), other.restore()) && Objects.equals(lastModified(), other.lastModified()) && Objects.equals(contentLength(), other.contentLength()) && Objects.equals(eTag(), other.eTag()) && Objects.equals(missingMeta(), other.missingMeta()) && Objects.equals(versionId(), other.versionId()) && Objects.equals(cacheControl(), other.cacheControl())
/** * Subtract the contentLength of {@link GetObjectResponse} if trailing checksums is enabled. */ @Override public SdkResponse modifyResponse(Context.ModifyResponse context, ExecutionAttributes executionAttributes) { SdkResponse response = context.response(); SdkHttpResponse httpResponse = context.httpResponse(); if (getObjectChecksumEnabledPerResponse(context.request(), httpResponse)) { GetObjectResponse getResponse = (GetObjectResponse) response; return getResponse.toBuilder().contentLength(getResponse.contentLength() - S3_MD5_CHECKSUM_LENGTH).build(); } return response; } }