I came across two ways to read the Objects from GCS buckets.
storage.readAllBytes
An article (below) suggests use of “storage.readAllBytes”
https://cloud.google.com/storage/docs/downloading-objects-into-memory#code-samples-download-object-into-memory
The documentation says, this method is fast way to download entire object in memory, so I am assuming this makes one GET call to Google Cloud to download entire Object.
storage.get(blobId); blob.getContent()
This article suggest use of storage object to get the Blob first, and another request to get the Content.
Blob blob = storage.get(blobId);
String value = new String(blob.getContent());
I assume, above way of reading the data makes 2 HTTP GET calls to Google Cloud to download read Object.
I have a use case where my XML documents are 5-10 MB in size and I need to download them based on the Object id to perform some transformation in my Java application. I am trying to find fastest way to read the document in my Java application.
Wanted to ask, which of the above methods should be used for faster download time.