title: How can I read the contents of a DocumentFile in Android?
body: <p>I have added a feature to an application to allow the user to create a local backup on external storage. That part is working great, but I am having trouble restoring that back up.</p>
  <p>Using the SAF, I have found an easy way for the user to select the file they are wanting to restore. The file they choose comes back to the app as a <code>DocumentFile</code></p>
  <p>How can I open the DocumentFile and read its contents on API 26 and up?</p>
  <p>So far I tried 2 things and neither worked:</p>
  <p>1)
  <code>new File(myDocumentFile.getUri().getPath())</code></p>
  <p>2)
  I've tried <a href="https://stackoverflow.com/questions/59000390/android-accessing-files-in-native-c-c-code-with-google-scoped-storage-api/59004193#59004193">this</a> answer but it didn't work. It is also so hacky and I don't really need access to the java.io.File I just need a way to read the contents.</p>
  <p>How does Google want us to approach reading user's files?</p>