简体   繁体   English

如何仅使用BlobKey从blobstore加载和保存整个文件?

[英]How load and save entire file from blobstore, using only BlobKey?

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. 将其保存到blobstore后,我想将其加载到内存中进行编辑。 After storing file I got BlobKey in return. 存储文件后,我得到了BlobKey作为回报。 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. 问题是我不知道文件有多大,所以我不知道作为endIndex变量传递什么。 How, having only BlobKey , do I load a file from blobstore, change it, save new version and recive new BlobKey of changed file? 仅具有BlobKey ,如何从blobstore加载文件,进行更改,保存新版本并获取已更改文件的新BlobKey

From the javadoc reference , seems like you can load a BlobInfo object that will contain your size. javadoc参考中 ,您似乎可以加载将包含您的大小的BlobInfo对象。 You just need to call 你只需要打电话

BlobInfoFactory() bif = New BlobInfoFactory();
BlobInfo bi = bif.loadBlobInfo(blobKey);
long size = bi.getSize();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM