Lines Matching refs:file

5  * you may not use this file except in compliance with the License.
60 * A helper class for {@link android.provider.DocumentsProvider} to perform file operations on local
86 protected abstract String getDocIdForFile(File file) throws FileNotFoundException;
117 File file = getFileForDocId(documentId);
118 if (!(file.exists() && file.isFile() && file.canRead())) {
121 String filePath = file.getAbsolutePath();
123 if (getTypeForFile(file).equals(MIMETYPE_JPEG)
124 || getTypeForFile(file).equals(MIMETYPE_JPG)) {
127 MetadataReader.getMetadata(metadata, stream, getTypeForFile(file), tags);
169 final File file = FileUtils.buildUniqueFile(parent, mimeType, displayName);
172 if (!file.mkdir()) {
173 throw new IllegalStateException("Failed to mkdir " + file);
175 childId = getDocIdForFile(file);
179 if (!file.createNewFile()) {
180 throw new IllegalStateException("Failed to touch " + file);
182 childId = getDocIdForFile(file);
184 throw new IllegalStateException("Failed to touch " + file + ": " + e);
287 final File file = getFileForDocId(docId);
290 final boolean isDirectory = file.isDirectory();
292 FileUtils.deleteContents(file);
294 if (!file.delete()) {
295 throw new IllegalStateException("Failed to delete " + file);
320 // Remove media store entry for this exact file.
347 for (File file : parent.listFiles()) {
348 includeFile(result, null, file);
359 * @param query the search condition used to match file names
361 * @param exclusion absolute file paths to exclude from result
374 final File file = pending.removeFirst();
375 if (file.isDirectory()) {
376 for (File child : file.listFiles()) {
380 if (file.getName().toLowerCase().contains(query)
381 && !exclusion.contains(file.getAbsolutePath())) {
382 includeFile(result, null, file);
390 final File file = getFileForDocId(documentId);
391 return getTypeForFile(file);
398 final File file = getFileForDocId(documentId);
403 return ParcelFileDescriptor.open(file, pfdMode);
408 file, pfdMode, mHandler, (IOException e) -> scanFile(visibleFile));
425 final File file = getFileForDocId(documentId);
426 return DocumentsContract.openImageThumbnail(file);
429 protected RowBuilder includeFile(MatrixCursor result, String docId, File file)
432 docId = getDocIdForFile(file);
434 file = getFileForDocId(docId);
439 if (file.canWrite()) {
440 if (file.isDirectory()) {
453 final String mimeType = getTypeForFile(file);
454 final String displayName = file.getName();
462 row.add(Document.COLUMN_SIZE, file.length());
467 long lastModified = file.lastModified();
476 private static String getTypeForFile(File file) {
477 if (file.isDirectory()) {
480 return getTypeForName(file.getName());
505 private void startObserving(File file, Uri notifyUri) {
507 DirectoryObserver observer = mObservers.get(file);
510 file, getContext().getContentResolver(), notifyUri);
512 mObservers.put(file, observer);
520 private void stopObserving(File file) {
522 DirectoryObserver observer = mObservers.get(file);
527 mObservers.remove(file);
545 public DirectoryObserver(File file, ContentResolver resolver, Uri notifyUri) {
546 super(file.getAbsolutePath(), NOTIFY_EVENTS);
547 mFile = file;
562 return "DirectoryObserver{file=" + mFile.getAbsolutePath() + ", ref=" + mRefCount + "}";
569 public DirectoryCursor(String[] columnNames, String docId, File file) {
575 mFile = file;