This commit is contained in:
Looly 2022-10-26 21:31:04 +08:00
parent 0d52562180
commit ad5296866d
5 changed files with 33 additions and 4 deletions

View File

@ -19,8 +19,8 @@ import java.util.concurrent.TimeUnit;
* <p>
* 使用方法如下
*
* <pre>
* StopWatch stopWatch = new StopWatch("任务名称");
* <pre>{@code
* StopWatch stopWatch = StopWatch.of("任务名称");
*
* // 任务1
* stopWatch.start("任务一");
@ -35,13 +35,22 @@ import java.util.concurrent.TimeUnit;
* // 打印出耗时
* Console.log(stopWatch.prettyPrint());
*
* </pre>
* }</pre>
*
* @author Spring Framework, Looly
* @since 4.6.6
*/
public class StopWatch {
/**
* 创建计时任务秒表
*
* @return StopWatch
*/
public static StopWatch of() {
return new StopWatch();
}
/**
* 创建计时任务秒表
*

View File

@ -8,6 +8,7 @@ import java.io.Writer;
* @author looly
* @since 5.3.3
*/
@SuppressWarnings("NullableProblems")
public final class FastStringWriter extends Writer {
private static final int DEFAULT_CAPACITY = 16;

View File

@ -1,5 +1,6 @@
package cn.hutool.core.io;
package cn.hutool.core.util;
import cn.hutool.core.io.IORuntimeException;
import cn.hutool.core.io.resource.ResourceUtil;
import java.io.File;

View File

@ -0,0 +1,17 @@
package cn.hutool.core.io;
import cn.hutool.core.text.StrUtil;
import org.junit.Assert;
import org.junit.Test;
public class FastStringWriterTest {
@SuppressWarnings("resource")
@Test
public void writeTest() {
final FastStringWriter fastStringWriter = new FastStringWriter(IoUtil.DEFAULT_BUFFER_SIZE);
fastStringWriter.write(StrUtil.repeat("hutool", 2));
Assert.assertEquals("hutoolhutool", fastStringWriter.toString());
}
}

View File

@ -1,5 +1,6 @@
package cn.hutool.core.io;
import cn.hutool.core.util.ManifestUtil;
import org.junit.Assert;
import org.junit.Test;