[Android] Add canWrite(Uri uri) util method

Geoffrey Métais git at videolan.org
Mon Apr 18 16:07:08 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Apr 18 15:31:24 2016 +0200| [86ce3d51bcb98223a21c373806eda425a1efc959] | committer: Geoffrey Métais

Add canWrite(Uri uri) util method

> https://code.videolan.org/videolan/vlc-android/commit/86ce3d51bcb98223a21c373806eda425a1efc959
---

 vlc-android/src/org/videolan/vlc/util/FileUtils.java | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/util/FileUtils.java b/vlc-android/src/org/videolan/vlc/util/FileUtils.java
index 545e33d..202cc5f 100644
--- a/vlc-android/src/org/videolan/vlc/util/FileUtils.java
+++ b/vlc-android/src/org/videolan/vlc/util/FileUtils.java
@@ -235,6 +235,17 @@ public class FileUtils {
         });
     }
 
+    public static boolean canWrite(Uri uri){
+        if (uri == null)
+            return false;
+        if (TextUtils.equals("file", uri.getScheme()))
+            return canWrite(uri.toString());
+        if (TextUtils.equals("content", uri.getScheme()))
+            return canWrite(getPathFromURI(uri));
+        return false;
+
+    }
+
     public static boolean canWrite(String path){
         if (path == null)
             return false;



More information about the Android mailing list