This is an example of what causes this exception
http://hastebin.com/mayuyuvimu.avrasm
This gives:
Exception in thread "main" java.nio.channels.ClosedByInterruptException
at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:202)
at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:880)
at Main.main(Main.java:17)
----------------------
Anyway, there doesn't seem to be any sane way of dealing with this. If interrupt is intended to mean stop what you are doing and stop the thread cleanly, then this works against that. This prevents you doing any more writes to the file. Is the intention that you reopen the file and then do the writes.
Also, it doesn't even clear the interrupted flag. So, you have to wipe the flag manually if you want to repeat the write attempt.