@Test public void testToFile() throws Exception { Assert.assertNotEquals(IoUtils.toFile(Uri.fromFile(new File("."))), new File(".")); Assert.assertEquals(IoUtils.toFile(Uri.fromFile(new File("."))), new File(".").getAbsoluteFile()); Assert.assertEquals(IoUtils.toFile(Uri.fromFile(new File("/etc"))), new File("/etc")); Assert.assertEquals(IoUtils.toFile(Uri.parse("file:/a/b/c")), new File("/a/b/c")); Assert.assertNull(IoUtils.toFile(Uri.parse("http: }
public static File toFile(Uri uri) { if (uri != null && isFile(uri)) { return new File(uri.getPath()); } return null; }
IoUtils { public static File toFile(Uri uri) { if (uri != null && isFile(uri)) { return new File(uri.getPath()); } return null; } }
IoUtils { public static File toFile(Uri uri) { if (uri != null && isFile(uri)) { return new File(uri.getPath()); } return null; }  }
IoUtils { public static File toFile(Uri uri) { if (uri != null && isFile(uri)) { return new File(uri.getPath()); } return null; }  static boolean saveFile(File file, byte[] content); static boolean saveBitmap(File file, Bitmap bitmap,
                                     Bitmap.CompressFormat format, int quality); static boolean saveBitmap(ContentResolver contentResolver, Uri uri, Bitmap bitmap,
                                     Bitmap.CompressFormat format, int quality); static boolean copyAssets(AssetManager assetManager, String assetsPath, File dst); static boolean copyFile(File src, File dst); static boolean copyFile(ContentResolver contentResolver, Uri src, File dst); static boolean copyStream(InputStream src, File dst); static void copyStream(InputStream src, OutputStream dst); static FileOutputStream openFileOutputStream(File file); static boolean close(Closeable closeable); static String readString(File file); static String readString(InputStream in); static byte[] toByteArray(InputStream input); static long getExtStorageAvailable(); static boolean hasExtStorage(); static boolean rmFile(File file); static boolean rmR(File file); static long getTotalLength(File file); static boolean ensureDirsExist(File dir); static File fromFilesDir(Context context, String path); static File fromCacheDir(Context context, String path); static boolean isAppPrivate(Context context, File file); static boolean isInDataDir(Context context, File file); @NonNull static File getDCIMDirectory(String type); @NonNull static File getAvailableExternalStoragePublicDirectory(String type); @NonNull static File fromPublicPath(Context context, String path); @NonNull static File generateDatedFile(File directory, String suffix); @NonNull static File generateDatedFile(File directory, String suffix, boolean twoStage); @NonNull static File generateDatedFile(File directory, String suffix, boolean twoStage, boolean createNewFile); @NonNull static File createTempFile(Context context, String suffix, boolean isPublic); static boolean isFile(Uri uri); static File toFile(Uri uri); }
IoUtils { public static File toFile(Uri uri) { if (uri != null && isFile(uri)) { return new File(uri.getPath()); } return null; }  static boolean saveFile(File file, byte[] content); static boolean saveBitmap(File file, Bitmap bitmap,
                                     Bitmap.CompressFormat format, int quality); static boolean saveBitmap(ContentResolver contentResolver, Uri uri, Bitmap bitmap,
                                     Bitmap.CompressFormat format, int quality); static boolean copyAssets(AssetManager assetManager, String assetsPath, File dst); static boolean copyFile(File src, File dst); static boolean copyFile(ContentResolver contentResolver, Uri src, File dst); static boolean copyStream(InputStream src, File dst); static void copyStream(InputStream src, OutputStream dst); static FileOutputStream openFileOutputStream(File file); static boolean close(Closeable closeable); static String readString(File file); static String readString(InputStream in); static byte[] toByteArray(InputStream input); static long getExtStorageAvailable(); static boolean hasExtStorage(); static boolean rmFile(File file); static boolean rmR(File file); static long getTotalLength(File file); static boolean ensureDirsExist(File dir); static File fromFilesDir(Context context, String path); static File fromCacheDir(Context context, String path); static boolean isAppPrivate(Context context, File file); static boolean isInDataDir(Context context, File file); @NonNull static File getDCIMDirectory(String type); @NonNull static File getAvailableExternalStoragePublicDirectory(String type); @NonNull static File fromPublicPath(Context context, String path); @NonNull static File generateDatedFile(File directory, String suffix); @NonNull static File generateDatedFile(File directory, String suffix, boolean twoStage); @NonNull static File generateDatedFile(File directory, String suffix, boolean twoStage, boolean createNewFile); @NonNull static File createTempFile(Context context, String suffix, boolean isPublic); static boolean isFile(Uri uri); static File toFile(Uri uri); static final String SCHEME_FILE; }