Reputation: 955
I want to service file (edit), that user uploaded to server. After saving it to blobstore, I want to load it to memory for editing. After storing file I got BlobKey
in return. As I understand, I should use the following method to load it into memory:
byte[] BlobstoreService.fetchData(BlobKey blobKey, long startIndex, long endIndex)
The problem is that I do not know how big the file is, so I do not know what to pass as the endIndex
variable. How, having only BlobKey
, do I load a file from blobstore, change it, save new version and recive new BlobKey
of changed file?
Upvotes: 0
Views: 88
Reputation: 4692
From the javadoc reference, seems like you can load a BlobInfo object that will contain your size. You just need to call
BlobInfoFactory() bif = New BlobInfoFactory();
BlobInfo bi = bif.loadBlobInfo(blobKey);
long size = bi.getSize();
Upvotes: 1