Java Examples for android.os.ParcelFileDescriptor
The following java examples will help you to understand the usage of android.os.ParcelFileDescriptor. These source code samples are taken from different open source projects.
Example 1
| Project: XobotOS-master File: IBluetoothHealthCallback.java View source code |
@Override
public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException {
switch(code) {
case INTERFACE_TRANSACTION:
{
reply.writeString(DESCRIPTOR);
return true;
}
case TRANSACTION_onHealthAppConfigurationStatusChange:
{
data.enforceInterface(DESCRIPTOR);
android.bluetooth.BluetoothHealthAppConfiguration _arg0;
if ((0 != data.readInt())) {
_arg0 = android.bluetooth.BluetoothHealthAppConfiguration.CREATOR.createFromParcel(data);
} else {
_arg0 = null;
}
int _arg1;
_arg1 = data.readInt();
this.onHealthAppConfigurationStatusChange(_arg0, _arg1);
reply.writeNoException();
return true;
}
case TRANSACTION_onHealthChannelStateChange:
{
data.enforceInterface(DESCRIPTOR);
android.bluetooth.BluetoothHealthAppConfiguration _arg0;
if ((0 != data.readInt())) {
_arg0 = android.bluetooth.BluetoothHealthAppConfiguration.CREATOR.createFromParcel(data);
} else {
_arg0 = null;
}
android.bluetooth.BluetoothDevice _arg1;
if ((0 != data.readInt())) {
_arg1 = android.bluetooth.BluetoothDevice.CREATOR.createFromParcel(data);
} else {
_arg1 = null;
}
int _arg2;
_arg2 = data.readInt();
int _arg3;
_arg3 = data.readInt();
android.os.ParcelFileDescriptor _arg4;
if ((0 != data.readInt())) {
_arg4 = android.os.ParcelFileDescriptor.CREATOR.createFromParcel(data);
} else {
_arg4 = null;
}
int _arg5;
_arg5 = data.readInt();
this.onHealthChannelStateChange(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5);
reply.writeNoException();
return true;
}
}
return super.onTransact(code, data, reply, flags);
}Example 2
| Project: devfestnorte-app-master File: DrawableTypeRequest.java View source code |
private static <A, Z, R> FixedLoadProvider<A, ImageVideoWrapper, Z, R> buildProvider(Glide glide, ModelLoader<A, InputStream> streamModelLoader, ModelLoader<A, ParcelFileDescriptor> fileDescriptorModelLoader, Class<Z> resourceClass, Class<R> transcodedClass, ResourceTranscoder<Z, R> transcoder) {
return streamModelLoader == null && fileDescriptorModelLoader == null ? null : new FixedLoadProvider<A, ImageVideoWrapper, Z, R>(new ImageVideoModelLoader<A>(streamModelLoader, fileDescriptorModelLoader), transcoder != null ? transcoder : glide.buildTranscoder(resourceClass, transcodedClass), glide.buildDataProvider(ImageVideoWrapper.class, resourceClass));
}Example 3
| Project: android-15-master File: BitmapFactoryTest.java View source code |
// tests that we can decode bitmaps from MemoryFiles
@SmallTest
public void testBitmapParcelFileDescriptor() throws Exception {
Bitmap bitmap1 = Bitmap.createBitmap(new int[] { Color.BLUE }, 1, 1, Bitmap.Config.RGB_565);
ByteArrayOutputStream out = new ByteArrayOutputStream();
bitmap1.compress(Bitmap.CompressFormat.PNG, 100, out);
ParcelFileDescriptor pfd = ParcelFileDescriptor.fromData(out.toByteArray(), null);
FileDescriptor fd = pfd.getFileDescriptor();
assertNotNull("Got null FileDescriptor", fd);
assertTrue("Got invalid FileDescriptor", fd.valid());
Bitmap bitmap = BitmapFactory.decodeFileDescriptor(fd);
assertNotNull("BitmapFactory returned null", bitmap);
assertEquals("Bitmap width", 1, bitmap.getWidth());
assertEquals("Bitmap height", 1, bitmap.getHeight());
}Example 4
| Project: android-sdk-sources-for-api-level-23-master File: SerialService.java View source code |
public ParcelFileDescriptor openSerialPort(String path) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.SERIAL_PORT, null);
for (int i = 0; i < mSerialPorts.length; i++) {
if (mSerialPorts[i].equals(path)) {
return native_open(path);
}
}
throw new IllegalArgumentException("Invalid serial port " + path);
}Example 5
| Project: android.support.graphics.pdf-master File: MainActivity.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imageView = (ImageView) findViewById(R.id.image_for_pdf);
final File file = new File(Environment.getExternalStorageDirectory(), "example.pdf");
try {
final ParcelFileDescriptor parcelFileDescriptor = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
final PdfRenderer pdfRenderer = new PdfRenderer(parcelFileDescriptor);
final int pageCount = pdfRenderer.getPageCount();
final PdfRenderer.Page page = pdfRenderer.openPage(6);
final int width = page.getWidth();
final int height = page.getHeight();
final Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
imageView.setBackgroundColor(0xffffffff);
page.render(bitmap, null, PdfRenderer.Page.RENDER_MODE_FOR_PRINT);
imageView.setImageBitmap(bitmap);
System.err.println("PageCount: " + pageCount);
} catch (Throwable e) {
throw new RuntimeException(e);
}
}Example 6
| Project: android_frameworks_base-master File: SerialService.java View source code |
public ParcelFileDescriptor openSerialPort(String path) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.SERIAL_PORT, null);
for (int i = 0; i < mSerialPorts.length; i++) {
if (mSerialPorts[i].equals(path)) {
return native_open(path);
}
}
throw new IllegalArgumentException("Invalid serial port " + path);
}Example 7
| Project: cnAndroidDocs-master File: SharedPreferencesBackupHelper.java View source code |
/**
* Backs up the configured {@link android.content.SharedPreferences} groups.
*/
public void performBackup(ParcelFileDescriptor oldState, BackupDataOutput data, ParcelFileDescriptor newState) {
Context context = mContext;
// If a SharedPreference has an outstanding write in flight,
// wait for it to finish flushing to disk.
QueuedWork.waitToFinish();
// make filenames for the prefGroups
String[] prefGroups = mPrefGroups;
final int N = prefGroups.length;
String[] files = new String[N];
for (int i = 0; i < N; i++) {
files[i] = context.getSharedPrefsFile(prefGroups[i]).getAbsolutePath();
}
// go
performBackup_checked(oldState, data, newState, files, prefGroups);
}Example 8
| Project: CSipSimple-master File: SipSharedPreferencesHelper.java View source code |
/* (non-Javadoc)
* @see android.app.backup.BackupHelper#performBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor)
*/
@Override
public void performBackup(ParcelFileDescriptor oldState, BackupDataOutput data, ParcelFileDescriptor newState) {
boolean forceBackup = (oldState == null);
long fileModified = 1;
if (prefsFiles != null) {
fileModified = prefsFiles.lastModified();
}
try {
if (!forceBackup) {
FileInputStream instream = new FileInputStream(oldState.getFileDescriptor());
DataInputStream in = new DataInputStream(instream);
long lastModified = in.readLong();
in.close();
if (lastModified < fileModified) {
forceBackup = true;
}
}
} catch (IOException e) {
Log.e(THIS_FILE, "Cannot manage previous local backup state", e);
forceBackup = true;
}
Log.d(THIS_FILE, "Will backup profiles ? " + forceBackup);
if (forceBackup) {
JSONObject settings = SipProfileJson.serializeSipSettings(mContext);
try {
writeData(data, settings.toString());
} catch (IOException e) {
Log.e(THIS_FILE, "Cannot manage remote backup", e);
}
}
try {
FileOutputStream outstream = new FileOutputStream(newState.getFileDescriptor());
DataOutputStream out = new DataOutputStream(outstream);
out.writeLong(fileModified);
out.close();
} catch (IOException e) {
Log.e(THIS_FILE, "Cannot manage final local backup state", e);
}
}Example 9
| Project: CSipSimple-old-master File: SipSharedPreferencesHelper.java View source code |
/* (non-Javadoc)
* @see android.app.backup.BackupHelper#performBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor)
*/
@Override
public void performBackup(ParcelFileDescriptor oldState, BackupDataOutput data, ParcelFileDescriptor newState) {
boolean forceBackup = (oldState == null);
long fileModified = 1;
if (prefsFiles != null) {
fileModified = prefsFiles.lastModified();
}
try {
if (!forceBackup) {
FileInputStream instream = new FileInputStream(oldState.getFileDescriptor());
DataInputStream in = new DataInputStream(instream);
long lastModified = in.readLong();
in.close();
if (lastModified < fileModified) {
forceBackup = true;
}
}
} catch (IOException e) {
Log.e(THIS_FILE, "Cannot manage previous local backup state", e);
forceBackup = true;
}
Log.d(THIS_FILE, "Will backup profiles ? " + forceBackup);
if (forceBackup) {
JSONObject settings = SipProfileJson.serializeSipSettings(mContext);
try {
writeData(data, settings.toString());
} catch (IOException e) {
Log.e(THIS_FILE, "Cannot manage remote backup", e);
}
}
try {
FileOutputStream outstream = new FileOutputStream(newState.getFileDescriptor());
DataOutputStream out = new DataOutputStream(outstream);
out.writeLong(fileModified);
out.close();
} catch (IOException e) {
Log.e(THIS_FILE, "Cannot manage final local backup state", e);
}
}Example 10
| Project: folio100_frameworks_base-master File: SharedPreferencesBackupHelper.java View source code |
/**
* Backs up the configured {@link android.content.SharedPreferences} groups.
*/
public void performBackup(ParcelFileDescriptor oldState, BackupDataOutput data, ParcelFileDescriptor newState) {
Context context = mContext;
// make filenames for the prefGroups
String[] prefGroups = mPrefGroups;
final int N = prefGroups.length;
String[] files = new String[N];
for (int i = 0; i < N; i++) {
files[i] = context.getSharedPrefsFile(prefGroups[i]).getAbsolutePath();
}
// go
performBackup_checked(oldState, data, newState, files, prefGroups);
}Example 11
| Project: frameworks_base_disabled-master File: BitmapFactoryTest.java View source code |
// tests that we can decode bitmaps from MemoryFiles
@SmallTest
public void testBitmapParcelFileDescriptor() throws Exception {
Bitmap bitmap1 = Bitmap.createBitmap(new int[] { Color.BLUE }, 1, 1, Bitmap.Config.RGB_565);
ByteArrayOutputStream out = new ByteArrayOutputStream();
bitmap1.compress(Bitmap.CompressFormat.PNG, 100, out);
ParcelFileDescriptor pfd = ParcelFileDescriptor.fromData(out.toByteArray(), null);
FileDescriptor fd = pfd.getFileDescriptor();
assertNotNull("Got null FileDescriptor", fd);
assertTrue("Got invalid FileDescriptor", fd.valid());
Bitmap bitmap = BitmapFactory.decodeFileDescriptor(fd);
assertNotNull("BitmapFactory returned null", bitmap);
assertEquals("Bitmap width", 1, bitmap.getWidth());
assertEquals("Bitmap height", 1, bitmap.getHeight());
}Example 12
| Project: platform_frameworks_base-master File: SerialService.java View source code |
public ParcelFileDescriptor openSerialPort(String path) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.SERIAL_PORT, null);
for (int i = 0; i < mSerialPorts.length; i++) {
if (mSerialPorts[i].equals(path)) {
return native_open(path);
}
}
throw new IllegalArgumentException("Invalid serial port " + path);
}Example 13
| Project: property-db-master File: BitmapFactoryTest.java View source code |
// tests that we can decode bitmaps from MemoryFiles
@SmallTest
public void testBitmapParcelFileDescriptor() throws Exception {
Bitmap bitmap1 = Bitmap.createBitmap(new int[] { Color.BLUE }, 1, 1, Bitmap.Config.RGB_565);
ByteArrayOutputStream out = new ByteArrayOutputStream();
bitmap1.compress(Bitmap.CompressFormat.PNG, 100, out);
ParcelFileDescriptor pfd = ParcelFileDescriptor.fromData(out.toByteArray(), null);
FileDescriptor fd = pfd.getFileDescriptor();
assertNotNull("Got null FileDescriptor", fd);
assertTrue("Got invalid FileDescriptor", fd.valid());
Bitmap bitmap = BitmapFactory.decodeFileDescriptor(fd);
assertNotNull("BitmapFactory returned null", bitmap);
assertEquals("Bitmap width", 1, bitmap.getWidth());
assertEquals("Bitmap height", 1, bitmap.getHeight());
}Example 14
| Project: robolectric-master File: ShadowParcelFileDescriptor.java View source code |
@Implementation public static ParcelFileDescriptor open(File file, int mode) throws FileNotFoundException { ParcelFileDescriptor pfd; try { Constructor<ParcelFileDescriptor> constructor = ParcelFileDescriptor.class.getDeclaredConstructor(FileDescriptor.class); pfd = constructor.newInstance(new FileDescriptor()); } catch (Exception e) { throw new RuntimeException(e); } Shadows.shadowOf(pfd).file = new RandomAccessFile(file, mode == ParcelFileDescriptor.MODE_READ_ONLY ? "r" : "rw"); return pfd; }
Example 15
| Project: Signal-Android-master File: MemoryFileUtil.java View source code |
public static ParcelFileDescriptor getParcelFileDescriptor(MemoryFile file) throws IOException { try { Method method = MemoryFile.class.getDeclaredMethod("getFileDescriptor"); FileDescriptor fileDescriptor = (FileDescriptor) method.invoke(file); Field field = fileDescriptor.getClass().getDeclaredField("descriptor"); field.setAccessible(true); int fd = field.getInt(fileDescriptor); if (Build.VERSION.SDK_INT >= 13) { return ParcelFileDescriptor.adoptFd(fd); } else { return ParcelFileDescriptor.dup(fileDescriptor); } } catch (IllegalAccessException e) { throw new IOException(e); } catch (InvocationTargetException e) { throw new IOException(e); } catch (NoSuchMethodException e) { throw new IOException(e); } catch (NoSuchFieldException e) { throw new IOException(e); } }
Example 16
| Project: cw-omnibus-master File: MainActivity.java View source code |
private FileDescriptor getStreamFd() {
ParcelFileDescriptor[] pipe = null;
try {
pipe = ParcelFileDescriptor.createPipe();
new TransferThread(new AutoCloseInputStream(pipe[0]), new FileOutputStream(getOutputFile())).start();
} catch (IOException e) {
Log.e(getClass().getSimpleName(), "Exception opening pipe", e);
}
return (pipe[1].getFileDescriptor());
}Example 17
| Project: android-database-sqlcipher-master File: SQLiteContentHelper.java View source code |
/**
* Runs an SQLite query and returns an AssetFileDescriptor for the
* blob in column 0 of the first row. If the first column does
* not contain a blob, an unspecified exception is thrown.
*
* @param db Handle to a readable database.
* @param sql SQL query, possibly with query arguments.
* @param selectionArgs Query argument values, or {@code null} for no argument.
* @return If no exception is thrown, a non-null AssetFileDescriptor is returned.
* @throws FileNotFoundException If the query returns no results or the
* value of column 0 is NULL, or if there is an error creating the
* asset file descriptor.
*/
public static AssetFileDescriptor getBlobColumnAsAssetFile(SQLiteDatabase db, String sql, String[] selectionArgs) throws FileNotFoundException {
android.os.ParcelFileDescriptor fd = null;
try {
MemoryFile file = simpleQueryForBlobMemoryFile(db, sql, selectionArgs);
if (file == null) {
throw new FileNotFoundException("No results.");
}
Class c = file.getClass();
try {
java.lang.reflect.Method m = c.getDeclaredMethod("getParcelFileDescriptor");
m.setAccessible(true);
fd = (android.os.ParcelFileDescriptor) m.invoke(file);
} catch (Exception e) {
android.util.Log.i("SQLiteContentHelper", "SQLiteCursor.java: " + e);
}
AssetFileDescriptor afd = new AssetFileDescriptor(fd, 0, file.length());
return afd;
} catch (IOException ex) {
throw new FileNotFoundException(ex.toString());
}
}Example 18
| Project: android-imf-ext-master File: SharedPreferencesBackupHelper.java View source code |
public void performBackup(ParcelFileDescriptor oldState, BackupDataOutput data, ParcelFileDescriptor newState) { Context context = mContext; // make filenames for the prefGroups String[] prefGroups = mPrefGroups; final int N = prefGroups.length; String[] files = new String[N]; for (int i = 0; i < N; i++) { files[i] = context.getSharedPrefsFile(prefGroups[i]).getAbsolutePath(); } // go performBackup_checked(oldState, data, newState, files, prefGroups); }
Example 19
| Project: android-packages-apps-calendar-compiled-master File: CalendarBackupAgent.java View source code |
@Override
public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) throws IOException {
// See Utils.getRingTonePreference for more info
final Editor editor = getSharedPreferences(GeneralPreferences.SHARED_PREFS_NAME_NO_BACKUP, Context.MODE_PRIVATE).edit();
editor.putString(GeneralPreferences.KEY_ALERTS_RINGTONE, GeneralPreferences.DEFAULT_RINGTONE).commit();
super.onRestore(data, appVersionCode, newState);
}Example 20
| Project: android-streams-ipc-master File: ParcelFileDescriptorUtil.java View source code |
public static ParcelFileDescriptor pipeFrom(InputStream inputStream, IThreadListener listener) throws IOException { ParcelFileDescriptor[] pipe = ParcelFileDescriptor.createPipe(); ParcelFileDescriptor readSide = pipe[0]; ParcelFileDescriptor writeSide = pipe[1]; // start the transfer thread new TransferThread(inputStream, new ParcelFileDescriptor.AutoCloseOutputStream(writeSide), listener).start(); return readSide; }
Example 21
| Project: android_packages_inputmethods_LatinIME-master File: BackupAgent.java View source code |
@Override
public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) throws IOException {
// Let the restore operation go through
super.onRestore(data, appVersionCode, newState);
// Remove the preferences that we don't want restored.
final SharedPreferences.Editor prefEditor = getSharedPreferences(getPackageName() + PREF_SUFFIX, MODE_PRIVATE).edit();
for (final String key : LocalSettingsConstants.PREFS_TO_SKIP_RESTORING) {
prefEditor.remove(key);
}
// Flush the changes to disk.
prefEditor.commit();
}Example 22
| Project: appcan-android-master File: ACEParcelFileDescriptorUtil.java View source code |
public static ParcelFileDescriptor pipeFrom(InputStream inputStream) throws IOException { ParcelFileDescriptor[] pipe = ParcelFileDescriptor.createPipe(); ParcelFileDescriptor readSide = pipe[0]; ParcelFileDescriptor writeSide = pipe[1]; // start the transfer thread new TransferThread(inputStream, new ParcelFileDescriptor.AutoCloseOutputStream(writeSide)).start(); return readSide; }
Example 23
| Project: bitcoin-android-master File: WalletBackupAgent.java View source code |
@Override public void onBackup(ParcelFileDescriptor oldState, BackupDataOutput data, ParcelFileDescriptor newState) throws IOException { // Hold the lock while the FileBackupHelper performs backup synchronized (ApplicationState.walletFileLock) { // Right now, we only keep one backup file in the cloud. The // "authoritative" file is the one on the phone. So we don't do any // checking to see what we're replacing in the cloud backup. Log.d("Wallet", "Backing up wallet file to cloud."); super.onBackup(oldState, data, newState); } }
Example 24
| Project: bitesize-kitkat-master File: AsyncStringWriter.java View source code |
@Override
protected Boolean doInBackground(AsyncStringWriterParams... params) {
Boolean success = false;
try {
ParcelFileDescriptor pfd = mContentResolver.openFileDescriptor(params[0].uri, "w");
FileOutputStream fileOutputStream = new FileOutputStream(pfd.getFileDescriptor());
fileOutputStream.write(params[0].newContent.getBytes(Charset.forName("UTF-8")));
fileOutputStream.close();
pfd.close();
success = true;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return success;
}Example 25
| Project: caw_shell-master File: AwPrintDocumentAdapter.java View source code |
@Override
public void onWrite(PageRange[] pages, ParcelFileDescriptor destination, CancellationSignal cancellationSignal, final WriteResultCallback callback) {
mPdfExporter.exportToPdf(destination, mAttributes, new ValueCallback<Boolean>() {
@Override
public void onReceiveValue(Boolean value) {
if (value) {
callback.onWriteFinished(new PageRange[] { PageRange.ALL_PAGES });
} else {
// TODO(sgurun) provide a localized error message
callback.onWriteFailed(null);
}
}
}, cancellationSignal);
}Example 26
| Project: chromium_webview-master File: AwPrintDocumentAdapter.java View source code |
@Override
public void onWrite(PageRange[] pages, ParcelFileDescriptor destination, CancellationSignal cancellationSignal, final WriteResultCallback callback) {
mPdfExporter.exportToPdf(destination, mAttributes, new ValueCallback<Boolean>() {
@Override
public void onReceiveValue(Boolean value) {
if (value) {
callback.onWriteFinished(new PageRange[] { PageRange.ALL_PAGES });
} else {
// TODO(sgurun) provide a localized error message
callback.onWriteFailed(null);
}
}
}, cancellationSignal);
}Example 27
| Project: clarity-mobile-master File: TestContentProvider.java View source code |
@Override public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException { String fileName = uri.getQueryParameter("realPath"); if (fileName == null) { fileName = uri.getPath(); } if (fileName == null || fileName.length() < 1) { throw new FileNotFoundException(); } CordovaResourceApi resourceApi = new CordovaResourceApi(getContext(), null); try { File f = File.createTempFile("test-content-provider", ".tmp"); resourceApi.copyResource(Uri.parse("file:///android_asset" + fileName), Uri.fromFile(f)); FileInputStream fis = new FileInputStream(f); String thisIsDumb = fis.getFD().toString(); int fd = Integer.parseInt(thisIsDumb.substring("FileDescriptor[".length(), thisIsDumb.length() - 1)); return ParcelFileDescriptor.adoptFd(fd); } catch (FileNotFoundException e) { throw e; } catch (IOException e) { e.printStackTrace(); throw new FileNotFoundException("IO error: " + e.toString()); } }
Example 28
| Project: deb-kitkat-storage-access-framework-master File: ParcelFileDescriptorTest.java View source code |
@Override protected Void doInBackground(ParcelFileDescriptor... params) { //Simulates long periodic network operation try { Thread.sleep(1000L); } catch (InterruptedException ignore) { } ParcelFileDescriptor pfd = params[0]; FileDescriptor fd = pfd.getFileDescriptor(); FileOutputStream out = new FileOutputStream(fd); byte[] data = givenData.getBytes(); try { out.write(data, 0, data.length); out.close(); pfd.close(); } catch (IOException ignore) { } return null; }
Example 29
| Project: DingDingMusic-master File: ImageUtils.java View source code |
public static Bitmap getArtworkQuick(Context context, long album_id, int w, int h) {
w -= 1;
ContentResolver res = context.getContentResolver();
Uri uri = ContentUris.withAppendedId(sArtworkUri, album_id);
if (uri != null) {
ParcelFileDescriptor fd = null;
try {
fd = res.openFileDescriptor(uri, "r");
if (fd == null) {
return null;
}
int sampleSize = 1;
sBitmapOptionsCache.inJustDecodeBounds = true;
BitmapFactory.decodeFileDescriptor(fd.getFileDescriptor(), null, sBitmapOptionsCache);
int nextWidth = sBitmapOptionsCache.outWidth >> 1;
int nextHeight = sBitmapOptionsCache.outHeight >> 1;
while (nextWidth > w && nextHeight > h) {
sampleSize <<= 1;
nextWidth >>= 1;
nextHeight >>= 1;
}
sBitmapOptionsCache.inSampleSize = sampleSize;
sBitmapOptionsCache.inJustDecodeBounds = false;
Bitmap b = BitmapFactory.decodeFileDescriptor(fd.getFileDescriptor(), null, sBitmapOptionsCache);
if (b != null) {
if (sBitmapOptionsCache.outWidth != w || sBitmapOptionsCache.outHeight != h) {
Bitmap tmp = Bitmap.createScaledBitmap(b, w, h, true);
if (tmp != b)
b.recycle();
b = tmp;
}
}
return b;
} catch (FileNotFoundException e) {
} finally {
try {
if (fd != null)
fd.close();
} catch (IOException e) {
}
}
}
return null;
}Example 30
| Project: glide-master File: VideoBitmapDecoder.java View source code |
@Override
public Resource<Bitmap> decode(ParcelFileDescriptor resource, int outWidth, int outHeight, Options options) throws IOException {
long frameTimeMicros = options.get(TARGET_FRAME);
if (frameTimeMicros < 0 && frameTimeMicros != DEFAULT_FRAME) {
throw new IllegalArgumentException("Requested frame must be non-negative, or DEFAULT_FRAME, given: " + frameTimeMicros);
}
Integer frameOption = options.get(FRAME_OPTION);
final Bitmap result;
MediaMetadataRetriever mediaMetadataRetriever = factory.build();
try {
mediaMetadataRetriever.setDataSource(resource.getFileDescriptor());
if (frameTimeMicros == DEFAULT_FRAME) {
result = mediaMetadataRetriever.getFrameAtTime();
} else if (frameOption == null) {
result = mediaMetadataRetriever.getFrameAtTime(frameTimeMicros);
} else {
result = mediaMetadataRetriever.getFrameAtTime(frameTimeMicros, frameOption);
}
} finally {
mediaMetadataRetriever.release();
}
resource.close();
return BitmapResource.obtain(result, bitmapPool);
}Example 31
| Project: now-launcher-master File: SongsManager.java View source code |
public Bitmap setAlbumArt(Long album_id, int dimensions) {
Bitmap bm = null;
try {
final Uri sArtworkUri = Uri.parse("content://media/external/audio/albumart");
Uri uri = ContentUris.withAppendedId(sArtworkUri, album_id);
ParcelFileDescriptor pfd = mcontext.getContentResolver().openFileDescriptor(uri, "r");
if (pfd != null) {
FileDescriptor fd = pfd.getFileDescriptor();
bm = Bitmap.createScaledBitmap(BitmapFactory.decodeFileDescriptor(fd), dimensions, dimensions, true);
}
} catch (Exception e) {
bm = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(mcontext.getResources(), R.drawable.unknownalbum), dimensions, dimensions, true);
}
return bm;
}Example 32
| Project: packages_inputmethods_latinime-master File: BackupAgent.java View source code |
@Override
public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) throws IOException {
// Let the restore operation go through
super.onRestore(data, appVersionCode, newState);
// Remove the preferences that we don't want restored.
final SharedPreferences.Editor prefEditor = getSharedPreferences(getPackageName() + PREF_SUFFIX, MODE_PRIVATE).edit();
for (final String key : LocalSettingsConstants.PREFS_TO_SKIP_RESTORING) {
prefEditor.remove(key);
}
// Flush the changes to disk.
prefEditor.commit();
}Example 33
| Project: platform_frameworks_support-master File: TestUtils.java View source code |
/**
* Saves a file from resources to a temporary location and returns a File instance for it.
*
* @param id Resource ID
*/
static File createFileFromResource(Context context, int id) throws IOException {
final File file = File.createTempFile("android.support.provider.tests{", "}.zip", context.getCacheDir());
try (final FileOutputStream outputStream = new ParcelFileDescriptor.AutoCloseOutputStream(ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_WRITE_ONLY));
final InputStream inputStream = context.getResources().openRawResource(id)) {
final byte[] buffer = new byte[32 * 1024];
int bytes;
while ((bytes = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytes);
}
outputStream.flush();
return file;
}
}Example 34
| Project: platform_packages_apps_calendar-master File: CalendarBackupAgent.java View source code |
@Override
public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) throws IOException {
// See Utils.getRingTonePreference for more info
final Editor editor = getSharedPreferences(GeneralPreferences.SHARED_PREFS_NAME_NO_BACKUP, Context.MODE_PRIVATE).edit();
editor.putString(GeneralPreferences.KEY_ALERTS_RINGTONE, GeneralPreferences.DEFAULT_RINGTONE).commit();
super.onRestore(data, appVersionCode, newState);
}Example 35
| Project: SealBrowser-master File: AwPrintDocumentAdapter.java View source code |
@Override
public void onWrite(PageRange[] pages, ParcelFileDescriptor destination, CancellationSignal cancellationSignal, final WriteResultCallback callback) {
mPdfExporter.exportToPdf(destination, mAttributes, new ValueCallback<Boolean>() {
@Override
public void onReceiveValue(Boolean value) {
if (value) {
callback.onWriteFinished(new PageRange[] { PageRange.ALL_PAGES });
} else {
// TODO(sgurun) provide a localized error message
callback.onWriteFailed(null);
}
}
}, cancellationSignal);
}Example 36
| Project: Tango-master File: TangoPub.java View source code |
@Override
protected void init(NodeMainExecutor nodeMainExecutor) {
// VioNode vioNode = new VioNode(mVinsServiceHelper);
// NodeConfiguration nodeConfiguration =
// NodeConfiguration.newPublic(InetAddressFactory.newNonLoopback().getHostAddress(), getMasterUri());
// nodeConfiguration.setMasterUri(getMasterUri());
ParcelFileDescriptor spp = mVinsServiceHelper.getCurrentSuperFrame();
FileDescriptor spfd = spp.getFileDescriptor();
FileInputStream spfis = new FileInputStream(spfd);
byte buffer[] = null;
try {
Log.i("Superframe", Integer.toString(spfis.read(buffer)));
Log.i("Superframe", buffer.toString());
} catch (IOException e) {
e.printStackTrace();
}
Log.i("Superframe", spp.toString());
Log.i("Superframe", spfd.toString());
// nodeMainExecutor.execute(mDepthView, nodeConfiguration);
// nodeMainExecutor.execute(vioNode, nodeConfiguration);
}Example 37
| Project: tekapp-master File: TestContentProvider.java View source code |
@Override public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException { String fileName = uri.getQueryParameter("realPath"); if (fileName == null) { fileName = uri.getPath(); } if (fileName == null || fileName.length() < 1) { throw new FileNotFoundException(); } CordovaResourceApi resourceApi = new CordovaResourceApi(getContext(), null); try { File f = File.createTempFile("test-content-provider", ".tmp"); resourceApi.copyResource(Uri.parse("file:///android_asset" + fileName), Uri.fromFile(f)); FileInputStream fis = new FileInputStream(f); String thisIsDumb = fis.getFD().toString(); int fd = Integer.parseInt(thisIsDumb.substring("FileDescriptor[".length(), thisIsDumb.length() - 1)); return ParcelFileDescriptor.adoptFd(fd); } catch (FileNotFoundException e) { throw e; } catch (IOException e) { e.printStackTrace(); throw new FileNotFoundException("IO error: " + e.toString()); } }
Example 38
| Project: THSRReceipt-Android-master File: CachedFileProvider.java View source code |
@Override public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException { switch(mUriMatcher.match(uri)) { case 1: String fileLocation = getContext().getCacheDir() + "/" + uri.getLastPathSegment(); Log.v("fileLocation = ", fileLocation); ParcelFileDescriptor parcelFileDescriptor = ParcelFileDescriptor.open(new File(fileLocation), ParcelFileDescriptor.MODE_READ_ONLY); return parcelFileDescriptor; default: throw new FileNotFoundException("ParcelFileDescriptor openFile is Error " + uri.toString()); } }
Example 39
| Project: traditional-archery-scoreboard-master File: BasicGoogleBackupAgent.java View source code |
@Override public void onBackup(final ParcelFileDescriptor oldState, final BackupDataOutput data, final ParcelFileDescriptor newState) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final FileInputStream fis = new FileInputStream(getDatabasePath("tac.db")); final byte[] buffer = new byte[1024]; int len = 0; while ((len = fis.read(buffer)) != -1) { baos.write(buffer, 0, len); } // while fis.close(); final byte[] result = baos.toByteArray(); data.writeEntityHeader(ARCHERY_BACKUP_KEY, result.length); data.writeEntityData(result, result.length); Log.i(TAG, "Sent " + result.length + " bytes to backup"); }
Example 40
| Project: Abelana-Android-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 41
| Project: almende-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 42
| Project: Android-Funny-Feed-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 43
| Project: AndroidSocialNetworks-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, String mode) throws FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 44
| Project: Android_Example_Projects-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 45
| Project: android_packages_apps-master File: TempFileProvider.java View source code |
private ParcelFileDescriptor getTempStoreFd() { String fileName = getScrapPath(getContext()); ParcelFileDescriptor pfd = null; try { File file = new File(fileName); // make sure the path is valid and directories created for this file. File parentFile = file.getParentFile(); if (!parentFile.exists() && !parentFile.mkdirs()) { Log.e(TAG, "[TempFileProvider] tempStoreFd: " + parentFile.getPath() + "does not exist!"); return null; } pfd = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_WRITE | android.os.ParcelFileDescriptor.MODE_CREATE); } catch (Exception ex) { Log.e(TAG, "getTempStoreFd: error creating pfd for " + fileName, ex); } return pfd; }
Example 46
| Project: ANE-Facebook-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 47
| Project: AngryKings-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 48
| Project: athere-android-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 49
| Project: barterli_android-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 50
| Project: BrainStudio-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 51
| Project: BrillaMXAndroid-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 52
| Project: CameraV-master File: IOCipherContentProvider.java View source code |
@Override public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException { ParcelFileDescriptor[] pipe = null; InputStream in = null; String pathKey = uri.getPath(); if (pathKey.startsWith("/")) ; pathKey = pathKey.substring(1); String pathReal = keyToPathMap.get(pathKey); try { File fileShare = new File(pathReal); pipe = ParcelFileDescriptor.createPipe(); in = new FileInputStream(fileShare); new PipeFeederThread(in, new AutoCloseOutputStream(pipe[1]) { }).start(); } catch (IOException e) { Log.e(TAG, "Error opening pipe", e); throw new FileNotFoundException("Could not open pipe for: " + uri.toString()); } return (pipe[0]); }
Example 53
| Project: CampusFeedv2-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 54
| Project: Carpuwl_android-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 55
| Project: carrot-unity-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 56
| Project: chat-sdk-android-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 57
| Project: ClassyGames-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 58
| Project: ClosedCirclesAndroid-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 59
| Project: ColourReflex-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 60
| Project: cordova-facebook-connect-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 61
| Project: cwac-provider-master File: AbstractPipeStrategy.java View source code |
/**
* {@inheritDoc}
*/
@Override
public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
if ("r".equals(mode)) {
ParcelFileDescriptor[] pipe = null;
try {
pipe = ParcelFileDescriptor.createPipe();
new TransferOutThread(getInputStream(uri), new AutoCloseOutputStream(pipe[1])).start();
} catch (IOException e) {
Log.e(getClass().getSimpleName(), "Exception opening pipe", e);
throw new FileNotFoundException("Could not open pipe for: " + uri.toString());
}
return (pipe[0]);
}
throw new IllegalArgumentException("Cannot support writing!");
}Example 62
| Project: devf-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 63
| Project: facebook-android-sdk-master File: FacebookContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = NativeAppCallAttachmentStore.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 64
| Project: facebook-api-android-maven-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 65
| Project: Facebook-master File: FacebookContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = NativeAppCallAttachmentStore.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 66
| Project: facebook-sdk-sbt-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 67
| Project: FacebookAnalytics-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 68
| Project: facebookfoobar-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 69
| Project: FacebookImageShareIntent-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 70
| Project: FacebookLoginInAndroidUsingParse-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 71
| Project: Facebool-Login-with-new-Graph-API-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 72
| Project: FiveInARowParse-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, String mode) throws FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 73
| Project: Flappy-And-Fire-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 74
| Project: flat-flatmates-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 75
| Project: FragmentOrientedApplication-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 76
| Project: Gathr-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, String mode) throws FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 77
| Project: gear2cam-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 78
| Project: GeoPost-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 79
| Project: GlobalGameJam2014-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 80
| Project: HelloMultidex-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 81
| Project: hoychatapp-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 82
| Project: ijoomer-adv-sdk-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 83
| Project: invite-friends-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 84
| Project: jaankari-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 85
| Project: KarungGuniApp-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 86
| Project: Klyph-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 87
| Project: KlyphMessenger-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 88
| Project: localhost-android-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 89
| Project: LoginFacebookAndroidStudio-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 90
| Project: Lovamimi-For-Android-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, String mode) throws FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 91
| Project: MeNextAndroid-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 92
| Project: meteor-cordova-facebook-login-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 93
| Project: MovieFriend-Android-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 94
| Project: ngui-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 95
| Project: packages_apps_Mms-master File: TempFileProvider.java View source code |
private ParcelFileDescriptor getTempStoreFd() { String fileName = getScrapPath(getContext()); ParcelFileDescriptor pfd = null; try { File file = new File(fileName); // make sure the path is valid and directories created for this file. File parentFile = file.getParentFile(); if (!parentFile.exists() && !parentFile.mkdirs()) { Log.e(TAG, "[TempFileProvider] tempStoreFd: " + parentFile.getPath() + "does not exist!"); return null; } pfd = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_WRITE | android.os.ParcelFileDescriptor.MODE_CREATE); } catch (Exception ex) { Log.e(TAG, "getTempStoreFd: error creating pfd for " + fileName, ex); } return pfd; }
Example 96
| Project: PaintDrip-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 97
| Project: phonegap-facebook-plugin-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 98
| Project: pico-phonegap-base-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 99
| Project: PicsHouse-Android-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 100
| Project: platform-friends-android-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }
Example 101
| Project: powerline-phonegap-master File: NativeAppCallContentProvider.java View source code |
@Override public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode) throws java.io.FileNotFoundException { Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri); if (callIdAndAttachmentName == null) { throw new FileNotFoundException(); } try { File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException exception) { Log.e(TAG, "Got unexpected exception:" + exception); throw exception; } }