class FileHelper {

    public static InputStreamReader openItemFile(Context context, Configuration.Item item) throws FileNotFoundException {
        if (item.location.startsWith("content://")) {
            try {
                return new InputStreamReader(context.getContentResolver().openInputStream(Uri.parse(item.location)));
            } catch (SecurityException e) {
                Log.d("FileHelper", "openItemFile: Cannot open", e);
                throw new FileNotFoundException(e.getMessage());
            }
        } else {
            File file = getItemFile(context, item);
            if (file == null)
                return null;
            if (item.isDownloadable())
                return new InputStreamReader(new SingleWriterMultipleReaderFile(getItemFile(context, item)).openRead());
            return new FileReader(getItemFile(context, item));
        }
    }

}