dcsimg
Manipulating Files - attribute status.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Thomas_Rosenbaum
Posted On:   Friday, June 14, 2002 06:10 AM

Is there a standard API method call that can change a File attribute from read-only to read-write status? (Windows or Unix?) Obviously the setReadOnly method within java.io.File does not "toggle" the status ... why isn't there a setReadWrite() method or better yet, a setReadStatus(char status) method that would take a character argument to represent read-only, read-write, hidden, etc. I can only think of two ways to rename a read-only file and both are messy - Read it into memory (or create a temp file), delete the original, and rewrite ... Or - call a command shell script Does anyone have any better ideas? Many than   More>>


Is there a standard API method call that can change a File attribute from read-only to read-write status? (Windows or Unix?)



Obviously the setReadOnly method within java.io.File does not "toggle" the status ... why isn't there a setReadWrite() method or better yet, a setReadStatus(char status) method that would take a character argument to represent read-only, read-write, hidden, etc.



I can only think of two ways to rename a read-only file and both are messy -



  • Read it into memory (or create a temp file), delete the original, and rewrite ...

  • Or - call a command shell script


Does anyone have any better ideas?


Many thanks,

~ Tom    <<Less
About | Sitemap | Contact