1

I get blobkey from datastore.
Now I want to use this blobkey to get content type of blob in blobstore.

How to do it?

4

1 回答 1

2

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();
于 2013-10-01T07:17:28.860 回答