How to perform basic operations on files using Doc

2019-08-12 02:58发布

问题:

Background

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).

The problem

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

  • read, write, using InputStream and OutputStream
  • move files.
  • create a folder and not just a file
  • rename a file
  • get file info (recent updated,etc...)
  • share/open the file via other apps.
  • other operations I might have forgot about.

The question

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

回答1:

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 ?

(I could not add a comment)