On Mon, Nov 15, 2004 at 03:39:01PM -0600, Filip Hanik - Dev wrote:
> this was not the case when using a java.io.FileOutputStream(), so I assume 
> you tried and verified this :)

        You are confused.  It _is_ the case with FileOutputStream.  The only
way it could be otherwise is if the output stream re-opens the file, either
on every write, or when it notices that the file name no longer refers to
the same file.

Create aa.java with this code:

import java.io.*;
public class aa
{
    public static void main(String[] args) throws Exception
    {
        FileOutputStream f = new FileOutputStream(args[0]);
        f.write(80); f.flush();
        synchronized(f) { f.wait(5 * 1000); }
        f.write(81); f.flush();
    }
}

And run this:
java aa foo &
mv foo bar

Notice that the output of the second write (which occurs after the file
is renamed) is in the original file (bar), not in a new foo.

eric

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to