本文介绍了如何从应用程序引擎上的BlobKey获取Blob文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个服务器端的问题。我有一个BlobKey,没有别的。如何从BlobKey获取blob文件名?我知道如何将servingUrl作为

 使用 BlobInfo   
$ b

  BlobInfoFactory blobInfoFactory = new BlobInfoFactory(); 
BlobInfo blobInfo = blobInfoFactory.loadBlobInfo(blobKey);
String fileName = blobInfo.getFilename();


This is a server side question. I have a BlobKey and nothing else. How do I get the blob filename from said BlobKey? I know how to get the servingUrl as

ServingUrlOptions options = ServingUrlOptions.Builder.withBlobKey(blobKey).secureUrl(false);
String servingUrl = ImagesServiceFactory.getImagesService().getServingUrl(options);

But how do I get the filename as saved/shown in Blob Viewer as for instance image_1.png? I am using Java -- not python.

解决方案

Use the BlobInfo class.

BlobInfoFactory blobInfoFactory = new BlobInfoFactory();
BlobInfo blobInfo = blobInfoFactory.loadBlobInfo(blobKey);
String fileName = blobInfo.getFilename();

这篇关于如何从应用程序引擎上的BlobKey获取Blob文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 13:45
查看更多