Android file class is understood according to official documents (GO)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.