mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-05 21:27:47 +08:00
#295 修复临时文件关闭
* update travis settings * feat(okhttp): 修改okhttp底层调用方法 直接用OkHttpClient代替connect.使客户端单一化.Okhttp 自动管理连接池优化 * feat(log,jsApi): 添加log debug 标记明确下调用底层效果,修复jsAPI Lock 为null 问题 添加log debug 标记明确下调用底层效果,修复jsAPI Lock 为null 问题 #293 * fix(File): 修复文件关闭 修复文件关闭 * Update OkHttpMediaDownloadRequestExecutor.java
This commit is contained in:
parent
111196baaf
commit
7a374c0ed4
@ -24,7 +24,7 @@ public class FileUtils {
|
||||
tmpFile = File.createTempFile(name, '.' + ext, tmpDirFile);
|
||||
}
|
||||
|
||||
// tmpFile.deleteOnExit();
|
||||
tmpFile.deleteOnExit();
|
||||
|
||||
try (FileOutputStream fos = new FileOutputStream(tmpFile)) {
|
||||
int read = 0;
|
||||
|
@ -62,6 +62,7 @@ public class OkHttpMediaDownloadRequestExecutor extends MediaDownloadRequestExec
|
||||
try (BufferedSink sink = Okio.buffer(Okio.sink(file))) {
|
||||
sink.writeAll(response.body().source());
|
||||
}
|
||||
file.deleteOnExit();
|
||||
return file;
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,8 @@ public class OkhttpQrCodeRequestExecutor extends QrCodeRequestExecutor<OkHttpCli
|
||||
try (BufferedSink sink = Okio.buffer(Okio.sink(temp))) {
|
||||
sink.writeAll(response.body().source());
|
||||
}
|
||||
temp.deleteOnExit();
|
||||
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user