Close not closed file on GC. #55

Relevant only for J2SE, not for J2ME.
This commit is contained in:
Enyby
2019-10-06 23:35:45 +03:00
parent 8345bee6b4
commit 832ec739ea

View File

@@ -118,6 +118,14 @@ public class IoLib extends TwoArgFunction {
public String tojstring() {
return "file: " + Integer.toHexString(hashCode());
}
public void finalize() {
if (!isclosed()) {
try {
close();
} catch (IOException ignore) {}
}
}
}
/** Enumerated value representing stdin */