Warp wrote:
> Unless I'm completely mistaken, this is not something you can achieve
> in Java. (In Java you have to close files explicitly and catch all
> possible exceptions which might otherwise bypass that closing.)
You don't have to *catch* the exception, but you do need extra code. I don't
even remember how to open a file in Java, so here's some pseudo-code:
FileStream fs = /* open a file */;
try {
fs.write("Hello\n");
String data = getData(); //may throw exception
fs.write(data);
} finally {
fs.close();
}
Post a reply to this message
|