Package com.google.cloud.storage
Class HttpStorageRpcHasherHelper
java.lang.Object
com.google.cloud.storage.HttpStorageRpcHasherHelper
Internal utility class to perform client-side CRC32C checksum validation on downloaded data
specifically for the
HttpStorageRpc transport layer.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanshouldValidate(com.google.api.client.http.HttpResponse response) Determines if client-side validation should be performed on the downloaded object.voidvalidate(com.google.api.client.http.HttpResponse response, OutputStream activeStream) Validates the downloaded output stream against GCS's expected base64-encoded value in response headers.voidvalidateCrc32c(String expectedCrc32cBase64, byte[] content) Validates a downloaded raw byte array against GCS's expected base64-encoded value.voidvalidateCrc32c(String expectedCrc32cBase64, int calculatedCrc32c) Validates a calculated CRC32C value against GCS's expected base64-encoded value.wrap(OutputStream out, boolean isChecksumValidationEnabled) Returns a wrapping output stream that hashes the written content if validation is enabled, or the original output stream otherwise.
-
Field Details
-
INSTANCE
-
-
Method Details
-
wrap
Returns a wrapping output stream that hashes the written content if validation is enabled, or the original output stream otherwise. -
validate
public void validate(com.google.api.client.http.HttpResponse response, OutputStream activeStream) throws IOException Validates the downloaded output stream against GCS's expected base64-encoded value in response headers.- Throws:
IOException- if the checksums do not match.
-
shouldValidate
public boolean shouldValidate(com.google.api.client.http.HttpResponse response) Determines if client-side validation should be performed on the downloaded object. -
validateCrc32c
Validates a calculated CRC32C value against GCS's expected base64-encoded value.- Throws:
IOException- if the checksums do not match.
-
validateCrc32c
Validates a downloaded raw byte array against GCS's expected base64-encoded value.- Throws:
IOException- if the checksums do not match.
-