[jcifs] setReadOnly, setReadWrite, or setAttributes?
Michael B Allen
mba2000 at ioplex.com
Wed Oct 29 11:20:39 EST 2003
Anyone notice java.io.File.setReadOnly will set a file to read-only but
there's no way to remove read-only from a file? I suppose someone was
concerned with security issues on filesystems that do not provide the
concept of ownership. I don't think this will be acceptable for us...
I am thinking of one of three possible solutions;
1) Provide both setReadOnly and setReadWrite.
2) Change the signature of setReadOnly to:
setReadOnly( boolean readonly );
where specifying false will remove read-only access.
3) Implement a more advanced set/getAttributes API such as:
static final int ATTR_ARCHIVE = 0x020;
static final int ATTR_COMPRESSED = 0x800;
static final int ATTR_NORMAL = 0x080;
static final int ATTR_HIDDEN = 0x002;
static final int ATTR_READONLY = 0x001;
static final int ATTR_TEMPORARY = 0x100;
static final int ATTR_DIRECTORY = 0x010;
static final int ATTR_SYSTEM = 0x004;
public int getAttributes() throws SmbException;
public void setAttributes( int attrs ) throws SmbException;
A program should be written to model the concepts of the task it
performs rather than the physical world or a process because this
maximizes the potential for it to be applied to tasks that are
conceptually similar and, more important, to tasks that have not
yet been conceived.
More information about the jcifs