[英]How to get content type from blobstore by blobkey?
I get blobkey from datastore. 我从数据存储区获取Blobkey。
Now I want to use this blobkey to get content type of blob in blobstore. 现在,我想使用此Blobkey在Blobstore中获取Blob的内容类型。
How to do it? 怎么做?
You can try this code 您可以尝试此代码
BlobInfoFactory bif = new BlobInfoFactory();
BlobKey bk = new BlobKey("<your blobkey>");
BlobInfo blobInfo = bif.loadBlobInfo(bk);
if(blobInfo == null)
// The blob with the provided blobkey does not exists
else
String contentType = blobInfo.getContentType();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.