mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
add method
This commit is contained in:
parent
e37dfc32a8
commit
246966d5f5
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# 5.7.18 (2021-12-23)
|
# 5.7.18 (2021-12-24)
|
||||||
|
|
||||||
### 🐣新特性
|
### 🐣新特性
|
||||||
* 【core 】 新增CollStreamUtil.groupKeyValue(pr#479@Gitee)
|
* 【core 】 新增CollStreamUtil.groupKeyValue(pr#479@Gitee)
|
||||||
@ -15,6 +15,7 @@
|
|||||||
* 【core 】 增加CollStreamUtil.groupBy(pr#484@Gitee)
|
* 【core 】 增加CollStreamUtil.groupBy(pr#484@Gitee)
|
||||||
* 【core 】 增加CollUtil.setValueByMap(pr#482@Gitee)
|
* 【core 】 增加CollUtil.setValueByMap(pr#482@Gitee)
|
||||||
* 【core 】 LocalDateTimeUtil增加endOfDay重载(issue#2025@Github)
|
* 【core 】 LocalDateTimeUtil增加endOfDay重载(issue#2025@Github)
|
||||||
|
* 【core 】 IoCopier增加setFlushEveryBuffer方法(issue#2022@Github)
|
||||||
*
|
*
|
||||||
### 🐞Bug修复
|
### 🐞Bug修复
|
||||||
* 【core 】 LineReadWatcher#onModify文件清空判断问题(issue#2013@Github)
|
* 【core 】 LineReadWatcher#onModify文件清空判断问题(issue#2013@Github)
|
||||||
|
@ -25,6 +25,11 @@ public abstract class IoCopier<S, T> {
|
|||||||
*/
|
*/
|
||||||
protected StreamProgress progress;
|
protected StreamProgress progress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否每次写出一个buffer内容就执行flush
|
||||||
|
*/
|
||||||
|
protected boolean flushEveryBuffer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构造
|
* 构造
|
||||||
*
|
*
|
||||||
@ -56,4 +61,16 @@ public abstract class IoCopier<S, T> {
|
|||||||
protected int bufferSize(long count) {
|
protected int bufferSize(long count) {
|
||||||
return (int) Math.min(this.bufferSize, count);
|
return (int) Math.min(this.bufferSize, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置是否每次写出一个buffer内容就执行flush
|
||||||
|
*
|
||||||
|
* @param flushEveryBuffer 是否每次写出一个buffer内容就执行flush
|
||||||
|
* @return this
|
||||||
|
* @since 5.7.18
|
||||||
|
*/
|
||||||
|
public IoCopier<S, T> setFlushEveryBuffer(boolean flushEveryBuffer){
|
||||||
|
this.flushEveryBuffer = flushEveryBuffer;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,6 +101,9 @@ public class ReaderWriterCopier extends IoCopier<Reader, Writer> {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
target.write(buffer, 0, read);
|
target.write(buffer, 0, read);
|
||||||
|
if(flushEveryBuffer){
|
||||||
|
target.flush();
|
||||||
|
}
|
||||||
|
|
||||||
numToRead -= read;
|
numToRead -= read;
|
||||||
total += read;
|
total += read;
|
||||||
|
@ -100,6 +100,9 @@ public class StreamCopier extends IoCopier<InputStream, OutputStream> {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
target.write(buffer, 0, read);
|
target.write(buffer, 0, read);
|
||||||
|
if(flushEveryBuffer){
|
||||||
|
target.flush();
|
||||||
|
}
|
||||||
|
|
||||||
numToRead -= read;
|
numToRead -= read;
|
||||||
total += read;
|
total += read;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user