Is there a way to pull User, Group , Other permissions of a file
I wanted to know whether Java provides any API to pull up each and every permission associated with a file.
For example: In Unix, a file has 3 sets of permissions as shown below:
r - for read
w - for write
x - for execute
There are some methods provided in java.io.File, such as canRead() and canWrite(), which help in telling whether a file is readable or writable. But I did not find any API which tells whether a perticular user has read/write/execute permission or not. Also, I presume the canRead(),canWrite() methods pull up the permissions pertaining to the owner of the file, but not for the group and others part of a Unix File's permissions.
Is there a way to pull up the read/write/executable permissions for all the 3 catergories namely, UserPermissions, GroupPermissions and Others'Permissions.
I appreciate your note on this and appreciate your time too.
No, canRead(),canWrite() methods check whether the application can read or write. It doesn't check whether the owner has any permission. I mean these methods check whether the user from which JVM is running has the permission to read or write permission to tha file.
At present there is no API which returns all three sets of permission of a file.
Last Post: 10-23-2005, 04:31 AM
Last Post: 12-10-2002, 03:27 PM
By Cynthia Leslie in forum Java
Last Post: 06-09-2001, 06:43 PM
Last Post: 01-03-2001, 10:40 AM
Last Post: 07-25-2000, 05:30 PM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL