| Author |
FileChannel rollback question
|
M Burke
Ranch Hand
Joined: Jun 25, 2004
Posts: 375
|
|
|
When FileChannel calls the transferFrom() method, if it fails in the middle somewhere, does it rollback it's changes?
|
 |
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18670
|
|
|
Unlikely. If you're concerned about this, I'd recommend copying the bytes to a tempfile first. If the transferFrom completes successfully, then close the FileChannel and rename the file to whatever name you originally wanted it to have. If a problem occurs during the transfer, simply delete the tempfile afterwards.
|
"I'm not back." - Bill Harding, Twister
|
 |
M Burke
Ranch Hand
Joined: Jun 25, 2004
Posts: 375
|
|
I would do that, but I need to append. There is a method in FileChannel called force(), it is suppose to make recovery possible. But it throws an exception, "Access is denied".
|
 |
 |
|
|
subject: FileChannel rollback question
|
|
|