I am now facing with a problem once uploading media files to Google Cloud Storage by using Google Cloud Storage API Java. To be more specific, the GCS API Java example just help us upload text files to Google Bucket but is not useful for media files. I also see some discussion from ticket: Written file not showing up in Google Cloud Storage that the team suggest to use a gsutil tool written by Python. I am not using blobstore as well
My question is how can I do with the following requirements: -Creating and deleting buckets. -Uploading, downloading, and deleting objects (such as media files). -Listing buckets and objects. -Moving, copying, and renaming objects.
by implementing with Java?
I thank you very much for your time and look forward to hearing from you.
createUploadUrl
. Similarly, to download you can create acreateGsBlobKey
with the Bucket name + Object name which can then be served by the Blobstore service.I faced a similar requirement when I had to deal with all sorts of documents including media objects such as images and videos. This is the implementation I followed based on the official documentation of Google Cloud Examples project on GitHub: Source Link
To Upload a file
To download a file
To delete a file
To provide temporary access to a file using a signed URL
Most of these methods are mentioned in this Google Github project. I just removed the clutter in my implementation. Hope this helps.