I wrote a Google App Engine application that uses Blobstore to save software-generated data. For this, I used the file API , which, unfortunately, is deprecated in favor of Google cloud storage. Therefore, I am rewriting my helper class to work with GCS.
I would like to keep the interface as similar as possible, as it was before, also because I save BlobKeys in the data store to support file references (and changing the model of a production application is always painful). When I save something in GCS, I get BlobKey with
BlobKey blobKey = blobstoreService.createGsBlobKey("/gs/" + fileName.getBucketName() + "/" + fileName.getObjectName());
as prescribed here , and I store it in a data warehouse.
So here's the question: the documentation tells me how to maintain a GCS file using blobstoreService.serve(blobKey, resp); in the servlet's answer, BUT how can I get the contents of a file (like an InputStream, an array of bytes or something else) to use it in my code for further processing? In my current implementation, I am doing this with a FileReadChannel from AppEngineFile showing (both deprecated).
source share