Methods Summary |
---|
private static void | closeQuietly(java.lang.AutoCloseable closeable)
if (closeable != null) {
try {
closeable.close();
} catch (RuntimeException rethrown) {
throw rethrown;
} catch (Exception ignored) {
}
}
|
public static android.net.Uri | createDirectory(android.content.Context context, android.net.Uri self, java.lang.String displayName)
return createFile(context, self, DocumentsContract.Document.MIME_TYPE_DIR, displayName);
|
public static android.net.Uri | createFile(android.content.Context context, android.net.Uri self, java.lang.String mimeType, java.lang.String displayName)
return DocumentsContract.createDocument(context.getContentResolver(), self, mimeType,
displayName);
|
public static android.net.Uri[] | listFiles(android.content.Context context, android.net.Uri self)
final ContentResolver resolver = context.getContentResolver();
final Uri childrenUri = DocumentsContract.buildChildDocumentsUriUsingTree(self,
DocumentsContract.getDocumentId(self));
final ArrayList<Uri> results = new ArrayList<Uri>();
Cursor c = null;
try {
c = resolver.query(childrenUri, new String[] {
DocumentsContract.Document.COLUMN_DOCUMENT_ID }, null, null, null);
while (c.moveToNext()) {
final String documentId = c.getString(0);
final Uri documentUri = DocumentsContract.buildDocumentUriUsingTree(self,
documentId);
results.add(documentUri);
}
} catch (Exception e) {
Log.w(TAG, "Failed query: " + e);
} finally {
closeQuietly(c);
}
return results.toArray(new Uri[results.size()]);
|
public static android.net.Uri | prepareTreeUri(android.net.Uri treeUri)
return DocumentsContract.buildDocumentUriUsingTree(treeUri,
DocumentsContract.getTreeDocumentId(treeUri));
|
public static android.net.Uri | renameTo(android.content.Context context, android.net.Uri self, java.lang.String displayName)
return DocumentsContract.renameDocument(context.getContentResolver(), self, displayName);
|