File has four constructors
public file (file dir,string name) Parameters The path to the new file object constructed for file and String,file, and string to make a new file name
Public File (String path) parameter is string, constructs a new file using the path set
< Strong>public file (String dirpath,string name) Dirpath for the specified path , name is the name of the file
public file (Uri Uri) Constructing a new file using the URI to specify the path
file Getfilesdir () Returns the directory in the path and keeps the application files. Here you get the/data/data//files directory, which returns a file
File Getcachedir ()method to get the/data/data//cache directory
Boolean Delete ()deleting filespublic Booleanequals (object obj) Determine if obj and the calling object are the same public File getabsolutefile () Return a new file, the absolute path to the file is the path of the called file Public String getabsolutefile () Returns the absolute path of the file public long getfreespace () & nbsp Returns the number of bytes remaining on the partition, including the path of the current file public String getName () Return the name of the file public String GetPath () Return the relative path of the file
Public String Getabsoultepath ()
Returns the absolute path of the file
Public long Gettotalspace () returns the total byte size of the partition public long Getusablespace () returns the size of the partition's available bytes
public boolean isdirectory ()
Determine if a folder
public boolean isfile ()
Determine if the file is
public boolean Ishidden ()
Determine if a hidden file is defined for the operating system
Public long LastModified ()
Returns the time, in milliseconds, that the file was last modified, counting from January 1, 1970
public long Length ()
Returns the length of the file, in bytes
public boolean mkdir ()
Create a folder when the parent directory exists to successfully create
public boolean mkdirs ()
Create a folder, Cocoa comes with create parent directory
public boolean Renameto (File NewPath)
Renaming the NewPath folder
Public Boolean setwritable (Boolean Writable,boolean owneronly)
Writable if true, there is write access to the file, otherwise there is no
Owneronly If it is true, only the owner of the file has write permission, otherwise, other people also have write permissions.
Public Boolean setwritable (Boolean writable,true)
With Setwritable (writable,true) a meaning
public boolean setreadonly ()
Read-only access to files
Public Boolean setreadable (Boolean Readable,boolean owneronly)
Readable if true, read access to the file
Owneronly If True, only read permission to the owner of the file, otherwise, read access to other people
Public Boolean setreadable (Boolean readable)
With Setreadable (Boolean readable,true) one meaning
Public String toString ()
ToString is a method of the object class that can return a string representation of a subject.
Public URI Touri ()
Returns the URI of a file
Android file class is understood according to official documents (GO)