close stream for IO.resourceExist
This commit is contained in:
@ -909,8 +909,13 @@ public class IO implements OS.FileSystem {
|
|||||||
* @param path jar 内文件路径,不需要 / 开始,如 config/TimiJava.ini
|
* @param path jar 内文件路径,不需要 / 开始,如 config/TimiJava.ini
|
||||||
* @return 数据流
|
* @return 数据流
|
||||||
*/
|
*/
|
||||||
public static boolean resourceExist(Class<?> clazz, String path) {
|
public static boolean resourceExist(Class<?> clazz, String path) throws IOException {
|
||||||
return resourceToInputStream(clazz, path) != null;
|
InputStream stream = resourceToInputStream(clazz, path);
|
||||||
|
if (stream != null) {
|
||||||
|
stream.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user