コード例 #1
0
 /**
  * Returns a MIME type of a document within an archive.
  *
  * @see DocumentsProvider.getDocumentType(String)
  */
 public String getDocumentType(String documentId) throws FileNotFoundException {
   Loader loader = null;
   try {
     loader = obtainInstance(documentId);
     return loader.get().getDocumentType(documentId);
   } finally {
     releaseInstance(loader);
   }
 }
コード例 #2
0
 /**
  * Returns metadata of a document within an archive.
  *
  * @see DocumentsProvider.queryDocument(String, String[])
  */
 public Cursor queryDocument(String documentId, @Nullable String[] projection)
     throws FileNotFoundException {
   Loader loader = null;
   try {
     loader = obtainInstance(documentId);
     return loader.get().queryDocument(documentId, projection);
   } finally {
     releaseInstance(loader);
   }
 }
コード例 #3
0
 @Override
 public void entryRemoved(boolean evicted, String key, Loader oldValue, Loader newValue) {
   oldValue.getWriteLock().lock();
   try {
     oldValue.get().close();
   } catch (FileNotFoundException e) {
     Log.e(TAG, "Failed to close an archive as it no longer exists.");
   } finally {
     oldValue.getWriteLock().unlock();
   }
 }
コード例 #4
0
 /**
  * Opens a thumbnail of a file within an archive.
  *
  * @see DocumentsProvider.openDocumentThumbnail(String, Point, CancellationSignal))
  */
 public AssetFileDescriptor openDocumentThumbnail(
     String documentId, Point sizeHint, final CancellationSignal signal)
     throws FileNotFoundException {
   Loader loader = null;
   try {
     loader = obtainInstance(documentId);
     return loader.get().openDocumentThumbnail(documentId, sizeHint, signal);
   } finally {
     releaseInstance(loader);
   }
 }
コード例 #5
0
 /**
  * Opens a file within an archive.
  *
  * @see DocumentsProvider.openDocument(String, String, CancellationSignal))
  */
 public ParcelFileDescriptor openDocument(
     String documentId, String mode, final CancellationSignal signal)
     throws FileNotFoundException {
   Loader loader = null;
   try {
     loader = obtainInstance(documentId);
     return loader.get().openDocument(documentId, mode, signal);
   } finally {
     releaseInstance(loader);
   }
 }
コード例 #6
0
 /**
  * Returns true if a document within an archive is a child or any descendant of the archive
  * document or another document within the archive.
  *
  * @see DocumentsProvider.isChildDocument(String, String)
  */
 public boolean isChildDocument(String parentDocumentId, String documentId) {
   Loader loader = null;
   try {
     loader = obtainInstance(documentId);
     return loader.get().isChildDocument(parentDocumentId, documentId);
   } catch (FileNotFoundException e) {
     throw new IllegalStateException(e);
   } finally {
     releaseInstance(loader);
   }
 }