简体   繁体   English

Dropbox java api获取文件详细信息

[英]Dropbox java api get file details

I am java developer.I need to get file information from dropbox using java api. 我是java开发人员。我需要使用java api从dropbox获取文件信息。 I tried with metadata class.Here i am getting only id,name,path,size of the file. 我试过元数据类。这里我只得到文件的id,名称,路径,大小。 But i need to get other information like owner name,mimetype,Createddate 但我需要获取其他信息,如所有者名称,mimetype,Createddate

ListFolderResult result = client.files().listFolderBuilder("")
                .withIncludeDeleted(false)
                .withRecursive(true)
                .withIncludeMediaInfo(true)
                .start();
 while (true) {
            List<Metadata> entries = result.getEntries();
            int idx = 0;

            for (Metadata metadata : entries) {
  if (metadata instanceof FolderMetadata) {
                    System.out.println("" + ++idx + ": FOLDER [" + metadata.getPathDisplay() + "], [" + metadata.getName() + "]");

                } else if (metadata instanceof FileMetadata) {
                    System.out.println("" + ++idx + ": File [" + metadata.getPathDisplay() + "], [" + metadata.getName() + "]");

                String filePath = metadata.getPathLower().replace(metadata.getName().toLowerCase(), "");
                System.out.println(metadata.getPathLower());
                System.out.println("FILE PATH"+filePath);
  System.out.println("Dropbox"+((FileMetadata) metadata).getRev());
                        System.out.println("Dropbox"+((FileMetadata) metadata).getClientModified());


                        System.out.println("Dropbox"+((FileMetadata) metadata).getMediaInfo());
                        System.out.println("Dropbox"+((FileMetadata) metadata).getMediaInfo().getMetadataValue());
                        System.out.println("Dropbox"+((FileMetadata) metadata).getSharingInfo());

.. ..

Thanks advance 谢谢你

The FileMetadata object that you get back is documented here: 您获取的FileMetadata对象在此处记录:

https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.0.x/com/dropbox/core/v2/files/FileMetadata.html https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.0.x/com/dropbox/core/v2/files/FileMetadata.html

It doesn't offer the additional information you're looking for, and there isn't another way to get it via the API, but we'll consider this a feature request. 它不提供您正在寻找的其他信息,并且没有其他方法可以通过API获取它,但我们会将此视为功能请求。

You can keep your own file extension to mime type mapping if you'd like though. 如果您愿意,可以将自己的文件扩展名保留为mime类型映射。 For example, you can find our groupings for some file types permission here: 例如,您可以在此处找到某些文件类型权限的分组:

https://www.dropbox.com/developers-v1/reference/devguide https://www.dropbox.com/developers-v1/reference/devguide

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

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