如何使用DocumentFile API文件执行基本操作? [英] How to perform basic operations on files using DocumentFile API?

查看:2459
本文介绍了如何使用DocumentFile API文件执行基本操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是API 21(棒棒堂),应用程序可以得到一个特殊的权限修改实时SD卡,在我写previous帖(如图所示开始的 这里 这里 )。

Starting from API 21 (Lollipop), apps can get a special "permission" to modify real SD-cards, as shown on previous posts I've written (here and here).

我可以删除文件,而我也可以创建他们,但我找不到执行其他基本的文件操作方式:

I can delete files, and I can also create them, but I can't find a way to perform other basic file operations:


  • 读,写,用InputStream和OutputStream

  • 将文件。

  • 创建一个文件夹,而不是只是一个文件

  • 重命名文件

  • 获取文件信息(更新最近,等...)

  • 分享/通过打开其他应用程序的文件。

  • 等操作我可能已经忘记了。

我如何获得这些功能?当然,有可能执行基本读写,例如...

How do I get those features? Surely it's possible to perform basic read and write, for example...

推荐答案

使用FileUilts为棒棒堂让你大多数选项,你见过这样的:
<一href=\"https://github.com/jeisfeld/Augendiagnose/blob/master/Augendiagnose/src/de/eisfeldj/augendiagnose/util/imagefile/FileUtil.java\" rel=\"nofollow\">https://github.com/jeisfeld/Augendiagnose/blob/master/Augendiagnose/src/de/eisfeldj/augendiagnose/util/imagefile/FileUtil.java ?

Using FileUilts for Lollipop gives you most of those options, have you seen this: https://github.com/jeisfeld/Augendiagnose/blob/master/Augendiagnose/src/de/eisfeldj/augendiagnose/util/imagefile/FileUtil.java ?

(我不能添加评论)

这篇关于如何使用DocumentFile API文件执行基本操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆