本文整理了Java中java.io.FileInputStream.finalize()
方法的一些代码示例,展示了FileInputStream.finalize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileInputStream.finalize()
方法的具体详情如下:
包路径:java.io.FileInputStream
类名称:FileInputStream
方法名:finalize
[英]Ensures that all resources for this stream are released when it is about to be garbage collected.
[中]确保在即将进行垃圾收集时释放此流的所有资源。
代码示例来源:origin: geoserver/geoserver
@Override
protected void finalize() throws IOException {
if (!closed) {
String warn =
"There is code leaving resource input streams open, locks around them might not be cleared! ";
if (!TRACE_ENABLED) {
warn +=
"Add -D"
+ GS_LOCK_TRACE
+ "=true to your JVM options to get a full stack trace of the code that acquired the input stream";
}
LOGGER.warning(warn);
if (TRACE_ENABLED) {
LOGGER.log(
Level.WARNING,
"The unclosed input stream originated on this stack trace",
tracer);
}
}
super.finalize();
}
};
代码示例来源:origin: org.postgresql/postgresql
protected void finalize() throws IOException {
// forcibly close it because super.finalize() may keep the FD open, which may prevent
// file deletion
close();
super.finalize();
}
};
内容来源于网络,如有侵权,请联系作者删除!