close source input stream (#1) (#1428)

This commit is contained in:
jsbxyyx
2023-08-11 05:55:33 +08:00
committed by GitHub
parent 12f29a3415
commit 5d09ee8b2b
+3 -2
View File
@@ -12,8 +12,9 @@ import java.nio.file.StandardCopyOption;
public class LibVosk {
private static void unpackDll(File targetDir, String lib) throws IOException {
InputStream source = LibVosk.class.getResourceAsStream("/win32-x86-64/" + lib + ".dll");
Files.copy(source, new File(targetDir, lib + ".dll").toPath(), StandardCopyOption.REPLACE_EXISTING);
try (InputStream source = LibVosk.class.getResourceAsStream("/win32-x86-64/" + lib + ".dll")) {
Files.copy(source, new File(targetDir, lib + ".dll").toPath(), StandardCopyOption.REPLACE_EXISTING);
}
}
static {