Hi,
I'm wandering why getChannel is only implemented in FileOutputStream and not in FileWriter.
Is there any true reason ? Is there a way to lock a FileWriter another way ?
thanks...
Hi,
I'm wandering why getChannel is only implemented in FileOutputStream and not in FileWriter.
Is there any true reason ? Is there a way to lock a FileWriter another way ?
thanks...
I suspect it is an oversight - note that FileWriter
is a subclass of OutputStreamWriter
that does nothing except pass a FileOutputStream
to the superclass constructor.
Note also that you should almost never use FileWriter
since it does not allow you to specify the encoding. Instead, "manually" wrap a FileOutputStream
in an OutputStreamWriter
- then you can also obtain the corresponding channel for locking.