mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
CharsetDetector增加默认识别的长度
This commit is contained in:
@@ -60,7 +60,7 @@ public class CharsetDetector {
|
||||
* @return 编码
|
||||
*/
|
||||
public static Charset detect(InputStream in, Charset... charsets) {
|
||||
return detect(IoUtil.DEFAULT_BUFFER_SIZE, in, charsets);
|
||||
return detect(IoUtil.DEFAULT_LARGE_BUFFER_SIZE, in, charsets);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -3,6 +3,7 @@ package cn.hutool.core.io;
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
@@ -16,4 +17,12 @@ public class CharsetDetectorTest {
|
||||
CharsetUtil.CHARSET_GBK, CharsetUtil.CHARSET_UTF_8);
|
||||
Assert.assertEquals(CharsetUtil.CHARSET_UTF_8, detect);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void issue2547() {
|
||||
final Charset detect = CharsetDetector.detect(IoUtil.DEFAULT_LARGE_BUFFER_SIZE,
|
||||
ResourceUtil.getStream("d:/test/default.txt"));
|
||||
Assert.assertEquals(CharsetUtil.CHARSET_UTF_8, detect);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user