FileDocCategorySizeDatePackage
TreeDocumentFile.javaAPI DocAndroid 5.1 API3412Thu Mar 12 22:22:56 GMT 2015android.support.v4.provider

TreeDocumentFile

public class TreeDocumentFile extends DocumentFile

Fields Summary
private android.content.Context
mContext
private android.net.Uri
mUri
Constructors Summary
TreeDocumentFile(DocumentFile parent, android.content.Context context, android.net.Uri uri)

        super(parent);
        mContext = context;
        mUri = uri;
    
Methods Summary
public booleancanRead()

        return DocumentsContractApi19.canRead(mContext, mUri);
    
public booleancanWrite()

        return DocumentsContractApi19.canWrite(mContext, mUri);
    
public DocumentFilecreateDirectory(java.lang.String displayName)

        final Uri result = DocumentsContractApi21.createDirectory(mContext, mUri, displayName);
        return (result != null) ? new TreeDocumentFile(this, mContext, result) : null;
    
public DocumentFilecreateFile(java.lang.String mimeType, java.lang.String displayName)

        final Uri result = DocumentsContractApi21.createFile(mContext, mUri, mimeType, displayName);
        return (result != null) ? new TreeDocumentFile(this, mContext, result) : null;
    
public booleandelete()

        return DocumentsContractApi19.delete(mContext, mUri);
    
public booleanexists()

        return DocumentsContractApi19.exists(mContext, mUri);
    
public java.lang.StringgetName()

        return DocumentsContractApi19.getName(mContext, mUri);
    
public java.lang.StringgetType()

        return DocumentsContractApi19.getType(mContext, mUri);
    
public android.net.UrigetUri()

        return mUri;
    
public booleanisDirectory()

        return DocumentsContractApi19.isDirectory(mContext, mUri);
    
public booleanisFile()

        return DocumentsContractApi19.isFile(mContext, mUri);
    
public longlastModified()

        return DocumentsContractApi19.lastModified(mContext, mUri);
    
public longlength()

        return DocumentsContractApi19.length(mContext, mUri);
    
public DocumentFile[]listFiles()

        final Uri[] result = DocumentsContractApi21.listFiles(mContext, mUri);
        final DocumentFile[] resultFiles = new DocumentFile[result.length];
        for (int i = 0; i < result.length; i++) {
            resultFiles[i] = new TreeDocumentFile(this, mContext, result[i]);
        }
        return resultFiles;
    
public booleanrenameTo(java.lang.String displayName)

        final Uri result = DocumentsContractApi21.renameTo(mContext, mUri, displayName);
        if (result != null) {
            mUri = result;
            return true;
        } else {
            return false;
        }