Android File access rights

Source: Internet
Author: User

File access Permissions

Android 's file access control is the same as Linux.

File access permissions: Who can access this file. Use drwxrwxrwx This is a character control

First letter

D: Indicates folder

-: Indicates file

Each of the following three letters is divided into a group

First group : rwx is the permission of the owner of the file

R:read, read

W:write, write

X:execute, Executive

-: Indicates that the permission is not

Second group : rwx represents the permissions that a user with a group of files owns to a file

R:read, read

W:write, write

X:execute, Executive

-: Indicates that the permission is not

Group Three:rwx represents the permissions that other users have on the file

R:read, read

W:write, write

X:execute, Executive

-: Indicates that the permission is not

Who creates the file, who owns the file, and the first set of permissions is the owner's permission

Any application, for other applications, is another user.

By default, the creator of the file has read and write permissions, and no other user has any permissions.
microsoftinternetexplorer402documentnotspecified7.8 lbs Normal0

Package Com.test.storage;

Import java.io.FileNotFoundException;

Import android.app.Activity;

Import Android.os.Bundle;

Import Android.view.View;

public   class   createfiledemo   extends   activity {

     @Override

    protected   void   oncreate ( bundle   savedinstancestate)  {

     //   auto-generated method  stub

    super oncreate (savedinstancestate);

     setcontentview ( r layout activity_main

}

public   void   click Span style= "font-family: Song body; Color: #000000; Font-size:12.0000pt "> ( view  v) {

path defaults to data/data/ app label package name /files/ cannot be changed

/* first parameter, file name

* The second parameter , mode_private , indicates that the file is private and cannot be modified by others, overwriting the previous content when it is written again .

*mode_append indicates that the file is private and cannot be modified by others, and is appended to the contents of the previously written file when it is written again .

*mode_world_readable is used to control whether other applications have permission to read and write to the file, indicating that the current file can be read by other applications

*mode_world_writeable is used to control whether other apps have permission to read and write to the file, indicating that the current file can be written by another application

* multiple modes can be used | Connection

*/

    try  {

    openfileoutput ( Span style= "font-family: Song body; Color: #000000; Font-size:12.0000pt ">,  mode_world_readable

     }    ( filenotfoundexception  e)  {

E. Printstacktrace ();

}

    }
}

Android File access rights

Related Article

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.