我想知道,在我关闭Reader之后,是否需要关闭InputStream?
try {
inputStream = new java.io.FileInputStream(file);
reader = new InputStreamReader(inputStream, Charset.forName("UTF-8"));
} catch (Exception exp) {
log.error(null, exp);
} finally {
if (false == close(reader)) {
return null;
}
// Do I need to close inputStream as well?
if (false == close(inputStream)) {
return null;
}
}
if (!close(reader)
而不是if (false == close(reader))
。 - Jacob Tomawif (!check) { thing(); return; } otherthing();
重排为if (check) { otherthing() } else { thing(); }
。 - Tom Hawtin - tacklinefinally
中的return
?啊啊啊啊啊啊啊啊啊! - Tom Hawtin - tackline