Android examples for java.security:DES
open a content URI and return the ParcelFileDescriptor.
// Copyright 2013 The Chromium Authors. All rights reserved. //package com.java2s; import android.content.ContentResolver; import android.content.Context; import android.net.Uri; import android.os.ParcelFileDescriptor; import android.util.Log; public class Main { private static final String TAG = "ContentUriUtils"; /**/*w ww.j a v a2 s . c om*/ * Helper method to open a content URI and return the ParcelFileDescriptor. * * @param context {@link Context} in interest. * @param uriString the content URI to open. * @returns ParcelFileDescriptor of the content URI, or NULL if the file does not exist. */ private static ParcelFileDescriptor getParcelFileDescriptor( Context context, String uriString) { ContentResolver resolver = context.getContentResolver(); Uri uri = Uri.parse(uriString); ParcelFileDescriptor pfd = null; try { pfd = resolver.openFileDescriptor(uri, "r"); } catch (java.io.FileNotFoundException e) { Log.w(TAG, "Cannot find content uri: " + uriString, e); } return pfd; } }